Wednesday, August 26, 2009

How to put oracle database in Archive log mode


Archive log and No-Archive log
We have the option of running the database in archive log or no- archive log (default). The difference between archive log and no-archive log is that in no-archive log the online redo log group which are used in cyclic manner and not backup up. In archive log, the redo logs are archived and for each redo log an archive log file is created.
The advantage of archive log is that the backup of database along with archive logs provides the complete recovery of database. Also, hot/online backups are possible only if the database is in archive log mode. However
In no-archive log mode, the database can be recovered only till the last available backup. All the changes done after the backup was taken needs to be redone.
How to put the database in Archive log mode
Make the following optional changes in the init. ora. If these changes are not made then default format and destination will be used by oracle.
log_archive_dest_1='location=/u01/archivelog'
LOG_ARCHIVE_FORMAT = arch_%t_%s_%r.arc
#log_archive_start=TRUE

Please note that in oracle 10g we don't need to give "log_archive_start=TRUE". It is required only in oracle 9i. Also we can specify upto 10 locations using the parameter "log_archive_dest_n" where n can have following values--1,2,..9. Also instead of local location we can specify a standby database using "service" instead of "location" parameter.
Now shutdown the database and mount it. Now execute the following command->
alter database archivelog;
Now open the database using
alter database open;
Now you can check whether the database is in archive log or not using
archive log list;
Also you can query the following tables->
v$log,v$archived_log

Merge Patches using admrgpch

Admrgph utility is used to merge two or more patches in oracle apps. The advantage of merging patches is that it reduces downtime as the repetitive task of compiling invalid database objects,  generating forms and reports,jar files etc.
How to use Admrgpch to merge patches
Download the  patches in /patch directory. Now create 2 subdirectory in /patch say mergesource -which contains  the unzipped patches to be merged and mergedest -which contains the merged patch. Please note that both mergesource and mergedest should be created as immediate child of same parent directory say /patch. Now you can execute the following command to merge the patches.
admrgpch -s <source> -d <dest> -merge_name <mergename>
For example->
admrgpch -s </patch/mergesource> -d </patch/mergedest> -merge_name <amebrup2>
Please make sure the the merge path log file "admrgpch.log" does not contain any error. If the  above command to merge patches completes successfully then it displays the following->
Executing the merge of the patch drivers
-- Processing patch: /patch/mergesource/5708576
-- Done processing patch: /patch/mergesource/5708576
-- Processing patch: /patch/mergesource/4428060
-- Done processing patch: /patch/mergesource/4428060
Copying files...
5% complete. Copied 269 files of 5373...
10% complete. Copied 538 files of 5373...
15% complete. Copied 806 files of 5373...
20% complete. Copied 1075 files of 5373...
25% complete. Copied 1344 files of 5373...
30% complete. Copied 1612 files of 5373...
35% complete. Copied 1881 files of 5373...
40% complete. Copied 2150 files of 5373...
45% complete. Copied 2418 files of 5373...
50% complete. Copied 2687 files of 5373...
55% complete. Copied 2956 files of 5373...
60% complete. Copied 3224 files of 5373...
65% complete. Copied 3493 files of 5373...
70% complete. Copied 3762 files of 5373...
75% complete. Copied 4030 files of 5373...
80% complete. Copied 4299 files of 5373...
85% complete. Copied 4568 files of 5373...
90% complete. Copied 4836 files of 5373...
95% complete. Copied 5105 files of 5373...
100% complete. Copied 5373 files of 5373...
Character-set converting files...
  2 unified drivers merged.
Patch merge completed successfully
Please check the log file at ./admrgpch.log
Now go to the destination merge patch directory say "mergedest". You can see that the admrgpch already created a driver with name "u_<mergename>.drv" say u_amebrup2.drv. Now apply the merged patch as a single patch using  adpatch. So you have to give this driver name u_<mergename>.drv" when prompted.
Restrictions of admrgpch ->
It will not merge patches of different releases,platform,different parallel modes. Also do not use admrgpch to merge AD and Non-AD patches ad AD patches will change the patch utility itself.

Technorati Tags: ,,,,