Sunday, 29 September 2013

AD Admin


               Adadmin is a utility that performs a number of tasks required from maintaining and

administering an Oracle Applications instance. It performs two types of works one is performed at

the database level and other is performed at the file system level. The user is required to provides all the informations at the adadmin prompt.

To start the adadmin login to the APPL_TOP as the owner of the application file system.

..........................................................................

[applmgr@apps ~]$ adadmin

                    
             Copyright (c) 2002 Oracle Corporation
                        Redwood Shores, California, USA

                     Oracle Applications AD Administration

                                 Version 11.5.0

NOTE: You may not use this utility for custom development
      unless you have written permission from Oracle Corporation.

Your default directory is '/apps/appsappl'.
Is this the correct APPL_TOP [Yes] ?

AD Administration records your AD Administration session in a text file
you specify.  Enter your AD Administration log file name or press [Return]
to accept the default file name shown in brackets.

Filename [adadmin.log] :

You can be notified by email if a failure occurs.
Do you wish to activate this feature [No] ?

Please enter the batchsize [1000] :


Please enter the name of the Oracle Applications System that this
APPL_TOP belongs to.

The Applications System name must be unique across all Oracle
Applications Systems at your site, must be from 1 to 30 characters
long, may only contain alphanumeric and underscore characters,
and must start with a letter.

Sample Applications System names are: "prod", "test", "demo" and
"Development_2".

Applications System Name [apps] : apps *


Do you currently have files used for installing or upgrading the database
installed in this APPL_TOP [YES] ? YES *


Do you currently have Java and HTML files for HTML-based functionality
installed in this APPL_TOP [YES] ? YES *


Do you currently have Oracle Applications forms files installed
in this APPL_TOP [YES] ? YES *


Do you currently have concurrent program files installed
in this APPL_TOP [YES] ? YES *


You are about to use or modify Oracle Applications product tables
in your ORACLE database 'apps'
using ORACLE executables in '/apps/appsora/8.0.6'.

Is this the correct database [Yes] ?

AD Administration needs the password for your 'SYSTEM' ORACLE schema
in order to determine your installation configuration.

Enter the password for your 'SYSTEM' ORACLE schema: manager


The ORACLE username specified below for Application Object Library
uniquely identifies your existing product group: APPLSYS

Enter the ORACLE password of Application Object Library [APPS] : apps

AD Administration is verifying your username/password.
...........................................................................

Once all the answers are given, the adadmin main menu appears.
In this menu there are Six main options. The first two deals with maintaining application file system
eg: re-linking the application, generating the form, regenerating the JAR files etc.

The next two deals with maintaining database objects eg: compiling and validating the schema, compiling the flexfield etc. The fifth option changes the maintenance mode, and sixth is for exist





1: Generate Applications File Menu:



1. Generate message file:

This option generates all the Oracle message files. Oracle Application uses this file to display message.This task generate message binary files (extension .msb) from Oracle Application Library tables.

2. Generating Forms files:

This options generates form files (extension .fmx) from binary forms file (extension .fmb). These files are normally located at AU_TOP, and the executable file are stored under each product directory.

3. Generate report files:

This option generates the Oracle report file (extension .rdf). You can generate report files of a specific products or you can generate reports files of all products.

4. Generate graphic files:

This option generates Oracle Graphic files (extension .ogd) from the graphic definition files.

5. Generate product JAR (Java Archive) files:
This the last option in the menu. It generates JAR files. It sings the JAR files and regenerate the product JAR files in JAVA_TOP and copies them to APPL_TOP.


2 : Maintain Application Files menu:
This menu takes care of the maintenance task required to keep your application files up-to-date.


1. Relink Application programs:

This option relinks Oracle Application programs with Oracle server libraries. This option should be use only when asked for specifically by Oracle.

2. Create Applications environment files:

This option create an environment file that defines your system configuration.

3. Copy files to destinations:

This option copies files from each product are to central location, where they can be easily referenced

by non-Application Programs. The file types copied to the respective destinations are

JAVA file to $JAVA_TOP
HTML file to $OAH_TOP
Media files to $OAM_TOP


4: Convert Character set:

This task converts the character set of all translatable files in the APPL_TOP. You should select this

task if you want to change the base language or add additional language to Oracle Applications.

This task has a sub menu.



It scans the APPL_TOP and creates files in $APPL_TOP/admin/$TWO_TASK/out directory

admanifest_excp.lst: lists files that will not be converted because of lossy conversion admanifest.lst: lists files that can be converted.

admainfest_lossy.lst: lists files with loss conversion , including line by line details.

Review the files listed in admanifest_excp.lst. Fix the files that report lossy conversion before you
convert the character set.

5: Maintain snapshot information:

Basically there are two types of snapshots

APPL_TOP: It lists patches and version of files in the APPL_TOP.

Global snapshot: It lists patches and latest versions of files in the entire Application system. (i.e. across all APPL_TOP's)

Both APPL_TOP and global snapshots may be either

Current view snapshot: A Current view snapshot is created once and updated when appropriate to maintain a consistent view.

named view snapshots: It is a copy of the current view snapshot at a particular time (not necessarily the latest) and it is not updated.

This menu has a sub menu.



6: Check for missing files:

This option verifies all the file required to run Oracle Applications for the present configuration are there in APPL_TOP, and checks if any are missing. The information about the missing files is written in admvrf.lst file and its location is $APPL_TOP/admin$TWO_TASK/out.


 3: Compiled/Reload Application Database entities:




1: Compile APPS schema:

This option compiles invalid objects in the APPS schema. Invalid objects in other schema as sys and system are not necessarily compiled. You can use multiple workers for parallel processing.

2: Compile menu information:

It compiles the menu data structure. It needs to be done if compile security concurrent requests submitted from the menu form fail or if you have uploaded menu entries to the FND_MENU_ENTRIES table.

3: Compile flex fields:

It compiles flex field data structure in Applications Object Library (AOL) tables. this needs to be done if the patch application changes the setup of flex field.

4: Reload JAR files to database:

It reloads all the Oracle Application JAR files to the database, choose this option if the patch readme says so or if all Oracle Application Java classes are removed from your database.


4: Maintain Application Database Entities:


1: Validate APPS schema:

Validating APPS schema means verifying the integrity of the APPS schema. It checks whether the APPS schema has proper roles and privileges or not. This task produces a report named 
<APPS schema name>.lst, which is located at $APPL_TOP/admin/$TWO_TASK/out.

2: Re-create grants and synonyms for APPS schema:

It recreates grants and synonyms for APPLSYSPUB, for APPS schema and for recreating grants on some packages from system to APPS. Each product's data objects are created in its own schema (such as AP schema) but the user accesses all data objects through the APPS schema. therefore the APPS schema must have the appropriate grants and synonyms for those objects.

3: Maintain multi-lingual tables:

This task need to be done after you add a new language. It maintains multilingual tables for Oracle Applications by adding missing, untranslated rows.

4:Check dual table:

It ensures that the dual table exists and has exactly one row. The dual table is created automatically by Oracle along with the data dictionary. This table has one column named "Dummy" of type Varchar2 and contains one row with a value of 'X'.

5: Maintain multiple reporting currencies schema:

It maintains multiple reporting currencies schema (MRC). If MRC functionality is not implements in your database, the option will read 'Convert to Multiple Reporting Currencies schema'.

6: Convert to multi-org:

This option appears as a menu choice only if multi-org is not installed in your database. Using this you can convert to multiple org architecture.


5: Changing Maintenance Mode:

This is the last option of adadmin menu. In Maintenance mode Oracle Application system is made accessible only for patching activities. This provides optimal performance for Auto Patch sessions. Maintenance mode is only needed for Auto Patch session.



To enable Maintenance mode enter 1
To disable Maintenance mode enter 2















































Friday, 20 September 2013

RMAN Catalog Configuration

                    There are couple of ways, we can setup the RMAN. We can use control file to store backup catalog information or we can have separate database to store catalog information. The CONTROL_FILE_RECORD_KEEP_TIME initialization parameter controls how long backup records are kept in the control file before those records are re-used to hold information about more recent backups. By default this parameter set to 7 days.


Benefits of using RMAN:

  •     Minimize the possibility of human error
  •     Simple command interface
  •     Manage the complexity of backup and recovery operations
  •     Unused block compression lets you skip unused data blocks, thus saving space and time.
  •     RMAN can be fully automated
  •     Make backups scalable and reliable
  •     Supports high-speed incremental backups
  •     Can perform error checking when backing up or during recovery
  •     Can perform image copies which are similar to operating system backup
  •     Can be used with 3rd party backup management software like Veritas Netbackup
  •     It is well integrated into OEM, so you can make use of Oracle's scheduler

   
RMAN terminology:

Backup piece: operating system file containing the backup of a data file, controlfile, etc
Backup set: logical structure that contains one or more backup pieces, all relevant backup pieces are contained in a backup set
Image copy: similar to operating system copies like cp or dd, they will contain all block if not used
Channel allocation: Channel allocation is a method of connecting rman and the target database while also specifying the type of backup i.e. disk or tape, they can created manually or automatically.


The Recovery Catalog:

RMAN will use the controlfile on the target database to store repository information regarding any backups for that server, this information can also be stored in a recovery catalog (optional) which resides on a rman server its own database which is dedicated to RMAN, information is still written to controlfile even if a recovery catalog is used.


RMAN Catalog Configuration:
To configure RMAN catalog follow the below steps



1: Source Database Must be in Archivelog mod:
            If source database is not in Archivelog mod. Configure the database in archivelog mod.
To check wether your database is in archivelog or no archivelog mod you can run following commands.

SQL> SELECT log_mode FROM v$database;

or you can confirm it by runnig following command.

SQL> ARCHIVE LOG LIST



2: Create a new database for the catalog : catdb



3: Configure listener on Source database:


4: Configure tns entery on catalog database: catdb



5: create rman "rman_user" user on source database:


6: create tablespace on catalog database: catdb

CREATE TABLESPACE rman
DATAFILE '/u02/oradata/rman/rman01.dbf' size 150m;


7: Create user and give default tablespace the one we created above. catdb

CREATE USER rman IDENTIFIED BY rman
DEFAULT TABLESPACE rman
QUOTA UNLIMITED ON rman;



7: Grant connect, resource, recovery_catalog_owner to the catalog user:

SQL> GRANT connect, resource, recovery_catalog_owner TO rman;

Here the role "RECOVERY_CATALOG_OWNER" provides the user with all privileges required to maintain and query the recovery catalog.


8: create password file on Source database:

9: connect to rman on catalog database: catdb

 $rman target /


10: create catalog: catdb

rman>create catalog;


11: connect to target database: catdb

$rman target rman_user/passwd @tns(tns filename) catalog rman/rman


12: then register the database: catdb

rman>register database



Make sure that the registration was successful by running REPORT SCHEMA:
RMAN> REPORT SCHEMA;

The following command will show you all the configuration of rman.

 rman>show all;









How to use CRONTAB

               Linux has a great program called cron. The crontab (cron derives from chronos, Greek for time, tab stands for table) command. Its a daemon/service that executes shell commands periodically on a given schedule. We could also use it to automatically create backups, synchronize files, schedule updates, and much more. Lets Know about crontab.

 
To see what crontabs are currently running on our system, we can open a terminal and run:

crontab –l

The above command displays the entries in crontab if any.

 
View Other Linux User’s Crontabs entries:

To view crontab entries of other Linux users, login to root and use -u {username} -l as shown below.

crontab -u oracle -l
@monthly /home/oracle/monthly-backup
00 09-18 * * * /home/oracle/check-db-status


To edit the list of cronjobs you can run:

crontab –e

This will open a default editor eg vi to let us edit the crontab. If you save and exit the editor,
all our cronjobs are saved into crontab. Cronjobs are written in the following format:

* * * * * /bin/testscript.sh


Edit Other Linux User’s Crontab File entries:

To edit crontab entries of other Linux users, login to root and use -u {username} -e as shown below.

crontab -u oracle -e
@monthly /home/oracle/monthly-backup
00 09-18 * * * /home/oracle/check-db-status
~
~
~
"/tmp/crontab.XXXXyjWkHw" 2L, 83C2

 
Removing a crontab file:

To remove your crontab file simply enter the following terminal command:

crontab -r


* * * * * /bin/testscript.sh

As we can see there are 5 stars. The stars represent different date parts in the following order:

1. minute (from 0 to 59)
2. hour (from 0 to 23)
3. day of month (from 1 to 31)
4. month (from 1 to 12)
5. day of week (from 0 to 6) (0=Sunday)


Execute something every minute:

If we want to execute the file “testscript.sh” every minute, then we need to do the following crontab entry.

* * * * * /home/oracle/testscript.sh

Please Note: If we leave the star (*) it means every. There are all star. So this means execute  /home/oracle/testscript.sh every minute.

1.every minute
2.every hour
3.every day of the month
4.every month
5.every day in the week.
So the above script will be executed every minute without exception.


Execute every Friday 2AM:

So if we want to schedule the script to run at 2AM every Friday, we would need to do the following cronjob entry:

0 2 * * 5 /bin/testscript.sh
                    or
0 0 * * Fri /bin/testscript.sh

Note: Get into the habit of using Fri instead of 5. Please note that the number starts with 0 (not with 1), and 0 is for Sun (not Mon).

So, the script will be executed when the system clock hits the following:

1. minute: 0
2. hour: 2
3. day: * (every day of month)
4. month: * (every month)
5. weekday: 5 (=Friday)


Execute on workdays 1AM:

If we want to schedule the script to Monday till Friday at 1 AM, we would need the following cronjob entry:

0 1 * * 1-5 /home/oracle/testscript.sh

The script will be executed when the system clock hits the following:

1. minute: 0
2. hour: 2
3. day: * (every day of month)
4. month: * (every month)
5. weekday: 1-5 (=Monday till Friday)


Execute a job every 5 months:

There is no direct way of saying ‘every 5 months’, instead you have to specify what specific months you want to run the job. Probably you may want to run the job on 5th month (May), and 10th month (Oct).

The fourth field is for Months. If you specify * in this field, it runs every month. To run for the specific month, you have to specify the number that corresponds to the month. For example, to run the job on May and Oct, you should specify 5,10 (or) you can simply use the 3 letter acronym of the month and specify May,Oct.

The third field is for DOM (Day of the Month). If you specify * in this field, it will run every day of the month. If you specify 1 in this month, it will run on 1st of the month.

The following example runs the testscript.sh twice a year.
i.e 1st May and 1st Oct.

0 0 1 5,10 * /home/ramesh/backup.sh
                          (or)
0 0 1 May,Oct * /home/ramesh/backup.sh


Schedule a Job Twice a Day:

The following script will run twice every day at 11:00 and 16:00 (4pm). The comma separated value in a field specifies that the command needs to be executed in all the mentioned time.

00 11,16 * * * /home/oracle/testscript.sh

00 – 0th Minute (Top of the hour)
11,16 – 11 AM and 4 PM
* – Every day
* – Every month
* – Every day of the week


Multiple commands:

A double-ampersand “&&” can be used to run multiple commands consecutively. The following example would run command1 and then command2 once a day:

@daily <command1> && <command2>

 
Execute a Linux Command After Every Reboot using @reboot:

Using the @reboot cron keyword, this will execute the specified command once after the machine got booted every time.

@reboot /home/oracle/testscript.sh


Crontab examples for practice:

Runs every minute:
* * * * * <command>

Runs at 40 minutes past the hour
40 * * * * <command>

Runs at 7:30 am every day
30 7 * * * <command>

Runs at 7:30 pm every day
30 18 * * * <command>

Runs at 1:00 am every Sunday
00 1 * * 0 <command>

Runs at 9:30 am on the first day of every month
30 9 1 * * <command>

 
There are also special strings that can be used:

Runs at boot
@reboot <command>

Runs once a year
@yearly <command>

Runs once a year
@annually <command>

Runs once a month
@monthly <command>

Runs once a week
@weekly <command>

Runs once a day
@daily <command>

Runs once a day
@midnight <command>

Runs once a hour
 @hourly <command>