25 July 2014

How to restore archive logs from rman backup

If some one need archive log to extract on disk for various purpose (cloning/Apply to DR) then we can follow below mention steps. For example purpose I will extract required archive log in /usr/tmp location. If we do not mention location the archive will be extracted to default location i.e $IRACLE_HOME/dbs


Step 1. Connect to rman (Target or catalog)

rman target /

 
Step 2. Example to restore 10 archive log from logseq 112710 to 112720

run
{
set archivelog destination to '/usr/tmp';
restore archivelog from logseq=112710 until logseq=112720 thread 1;
}

Other examples:-

1. Restore single archive log
 
run
{
set archivelog destination to '/usr/tmp';
restore archivelog from logseq=112710  thread 1;
}

2. Restore archive log in RAC environment 
If we want to restore archive log from Node 2 RAC then user thread 2, or use thread 1 for Node 1.
 
run
{
set archivelog destination to '/usr/tmp';
restore archivelog from logseq=112710 until logseq=112720 thread 2;
}

How to change Apps Password in R12.2

Apps password change routine in Release 12.2 E-Business Suite changed a little bit. We have now extra options to change password, as well as some manual steps after changing the password using FNDCPASS.

Whether you use FNDCPASS or AFPASSWD to change the APPLSYS/APPS password, you must also perform some additional steps. This is because in R12.2, the old AOL/J connection pooling is replaced with Weblogic Connection Pool ( JDBC Datasource ).  Currently this procedure is not yet automated. It would be good, if this can be automated using some WLS scripting.

Important: These steps must be carried out on the run file system.

1.   Shut down the application tier services using the $INST_TOP/admin/scripts/adstpall.sh script.

2.   Change the APPLSYS password, as described for the utility you are using.

3.   Start AdminServer using the $INST_TOP/admin/scripts/adadminsrvctl.sh script. Do not start any other application tier services.

4.   Change the "apps" password in WLS Datasource as follows:
1.   Log in to WLS Administration Console.
2.   Click Lock & Edit in Change Center.
3.   In the Domain Structure tree, expand Services, then select Data Sources.
4.   On the "Summary of JDBC Data Sources" page, select EBSDataSource.
5.   On the "Settings for EBSDataSource" page, select the Connection Pool tab.
6.   Enter the new password in the "Password" field.
7.   Enter the new password in the "Confirm Password" field.
8.   Click Save.
9.   Click Activate Changes in Change Center.

5.   Start all the application tier services using the $INST_TOP/admin/scripts/adstrtal.sh script.

6.   Verify the WLS Datastore changes as follows:
1.   Log in to WLS Administration Console.
2.   In the Domain Structure tree, expand Services, then select Data Sources.
3.   On the "Summary of JDBC Data Sources" page, select EBSDataSource.
4.   On the "Settings for EBSDataSource" page, select Monitoring > Testing.
5.   Select "oacore_server1".
6.   Click Test DataSource
7.   Look for the message "Test of EBSDataSource on server oacore_server1 was successful".

Important: Steps 4, 5 and 6 are only applicable when changing the APPLSYS password. They are not applicable when changing passwords for product schemas or the SYSTEM schema.

In the next prepare phase after the password change, adop will invoke EBS Domain Configuration to ensure that the WLS datasource on the patch file system will be synchronized with the new APPS password.

How to apply HRGLOBAL in R12.2

Step 1 -Apply hrglobal.drv

There are some changes to apply HRGLOBAL in R12.2 w.r.t previous EBS version. We need to apply hrglobal same as adop patch life cycle. Steps are as below mention.

a) Start an online patching cycle
Source the run edition environment file: Example: UNIX: $RUN_BASE/EBSapps/appl/APPS$CONTEXT_NAME.env

$ adop phase=prepare

b) Run DataInstall from PATCH edition
The command line DataInstall java utility should be run on the tier which has the $APPL_TOP available. It will perform view creation actions against the database pertaining to the options selected. For multi-node/RAC setups, DataInstall need only to be run on the primary node.
Run the DataInstall java utility in order to select the legislations you want to apply as follows:
java oracle.apps.per.DataInstall <un> <pw> thin <host:port: sid >
where
< un > is the username of the main apps account
<pw> is the password for this account
<host:port: sid > represents the database connection information

For example: java oracle.apps.per.DataInstall apps apps thin dbsvr1:1521:testdb
12.2 SPECIFIC: For an Online patch enabled instance, DataInstall will only be runnable against the Patch Edition (Environment is prepared using "adop phase=prepare").
In order to retain the same command line usage from previous codelines, if the connect information passed to the DataInstall utility points to the Run Edition, then DataInstall will internally switch to operate against the Patch Edition.
Aside from this scenario, or for environments that are not Online patch enabled, DataInstall will operate exactly as before.
RUP Upgrade best practice:
On upgrade to a newer RUP, it is advised to apply all live localisations
 and Core (even if no new prereqs are listed).
For customers running non supported localisations, they should install just Core on RUP upgrade

Usage of DataInstall is fairly straightforward, basically select/deselect legislations to install using the index number of the legislation shown in the list in menu 1 followed by I for install or C for clear;
e.g. In menu 1, to install Global choose 1I, to cancel a selected operation, choose 1C etc. Menu 4 to choose to save your changes when you are OK with them.

c) Apply hrglobal.drv

The driver is located at $PER_TOP/patch/115/driver/hrglobal.drv and should be run on the tier which has the $APPL_TOP available. In most cases this will be the Apps tier.
hrglobal.drv is a pure "database, d type" driver so the actions in the driver apply only to the database. As such, for RAC/multi-node setups, it is only required to run the hrglobal.drv on one node. Be mindful to only run the driver located in the directory $PER_TOP/patch/115/driver hrglobal.drv driver should be applied as per a normal patch using the adop utility.

12.2 SPECIFIC: The driver will be applied via the adop patcing utility, as opposed to adpatch which was used prior to 12.2.

Care must be taken when applying hrglobal.drv via adop that the following parameters are passed with the adop command line:

options=nocopyportion,nogenerateportion,forceapply

Example: adop phase=apply patchtop=$PER_TOP/patch/115 patches=driver:hrglobal.drv options=nocopyportion,nogenerateportion,forceapply
where $PER_TOP corresponds to the patch file system

These options are mandatory in order to
a) avoid adop trying to sync the file system when applying a patch (in this case the hrglobal.drv file) that contains database operations only and
b) ensure that adop will not consider during an upgrade to have been installed previously and proceed with the current request.
Please also ensure the forceapply parameter is at the end of the options list.

Note:
- adop apply phase by default runs in autoskip mode, meaning that if there is failure, it will be skipped and the failed file will be mentioned in the autoskip.log
- users wont see the failures on the screen where the adop command is running
- users need to review the autoskip.log file after the completion of hrglobal to find any failed files which are skipped and take appropriate action

Once completed and no issues are reported in the autoskip.log file, you have successfully installed your legislative HRMS data.
d) Complete the online patching cycle by running the following commands in the order shown:

1. $ adop phase=finalize
2. $ adop phase=cutover
3. $ adop phase=cleanup
Step 2 - OPTIONAL
For customers using other languages than US and wishing to apply translated legislative seed data, please apply the relevant language specific version of the consolidated translation patch after successfully completing the hrglobal.drv above.


6 July 2014

Enable/Disable Archive log mode in RAC 11gR2

Enable Archivelog

1)  Login to one of the nodes , verify the archive log mode

SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 200
Current log sequence 201

SQL> select name, log_mode from v$database;

NAME LOG_MODE
--------- ------------
PUB NOARCHIVELOG

2) Disable the cluster instance parameter by setting cluster_database to FALSE from the current instance:
sqlplus "/ as sysdba"

SQL> alter system set cluster_database=false scope=spfile sid='orcl1;


3) Shutdown all instances accessing the clustered database:

  srvctl stop database -d orcl

4)Using the local instance, MOUNT the database:

sqlplus "/ as sysdba"
SQL> startup mount 

5) Enable archiving:

SQL> alter database archivelog;

6) Re-enable support for clustering by modifying the instance parameter cluster_database to TRUE from the current instance:

SQL> alter system set cluster_database=true scope=spfile sid='orcl1;

7) Shutdown the local instance:

SQL> shutdown immediate 

8) Bring all instance back up using srvctl:

srvctl start database -d orcl

9)Login to the local instance and verify Archive Log Mode is enabled:

sqlplus "/ as sysdba"

SQL> archive log list
Database log mode            Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     200
Next log sequence to archive  201

After enabling Archive Log Mode, each instance in the RAC configuration can automatically archive redologs.


Disable Archivelog
1) export oracle_sid=orcl1

SQL> alter system set cluster_database=false scope=spfile sid='orcl1';
System altered.

2) srvctl stop database -d orcl -o immediate

3) SQL> startup mount

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 18
Next log sequence to archive 19
Current log sequence 19

SQL> alter database noarchivelog;
Database altered.

SQL> alter system set cluster_database=true scope=spfile sid='orcl1';
System altered.

SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.

4) srvctl start database -d orcl

5) export oracle_sid=orcl1
sqlplus / as sysdba

SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 18
Current log sequence 19
SQL>