Monday, July 21, 2008

ORACLE 10g RAC INSTALLATION

I hope you would have seen lots and lots of RAC install documents now a days, This is one of the installation performed for one my US based client. This is a 10g R2 Base release Installation on Sun Fire v 490 box.

Download link :
http://rapidshare.com/files/131310423/RAC_INSTALL.pdf.html



Below one is the other one installation which i have done for a HP-UX client.

http://rapidshare.com/files/131316003/HPUXRAC.doc.html

Friday, July 11, 2008

Create Oracle 10g Logical Standby Database

1. Backup a spfile copy from Production, Change the DB unique name parameter as per the new logical db name and proceed with the
db startup in no mount state in the logical standby .


2.
connected to target database: PWPRD (DBID=505738321)
connected to recovery catalog database
connected to auxiliary database: PWPRD (not mounted)

RMAN> run {
2> resync catalog;
3> allocate auxiliary channel t1 type 'SBT_TAPE' MAXOPENFILES 6 MAXPIECESIZE 8G
4> parms 'SBT_LIBRARY=/lib/libnwora.so,ENV=(NSR_SERVER=192.168.200.166,NSR_DATA_VOLUME_POOL=Database,NSR_GROUP=Oracle,NSR_DEBUG_
5> FILE=/tmp/debug.out)';
6> allocate auxiliary channel t2 type 'SBT_TAPE' MAXOPENFILES 6 MAXPIECESIZE 8G
7> parms 'SBT_LIBRARY=/lib/libnwora.so,ENV=(NSR_SERVER=192.168.200.166,NSR_DATA_VOLUME_POOL=Database,NSR_GROUP=Oracle,NSR_DEBUG_
8> FILE=/tmp/debug.out)';
9> duplicate target database for standby dorecover;
10> release channel t1;
11> release channel t2;
12> }


Please perform the restore as above

Note : After restore , Create spfile for your db and bounce your database


3. Add the following parameters to your database spfile

*.log_archive_config='dg_config=(PWPRD,PWPRDDR,PWRPPRD)'
*.log_archive_dest_1='LOCATION="+ARCHIVES", valid_for=(ONLINE_LOGFILE,ALL_ROLES)'
*.log_archive_dest_2='LOCATION=+ARCHIVES/PWRPPRD/STANDBY/ VALID_FOR=(STANDBY_LOGFILES, STANDBY_ROLE) DB_UNIQUE_NAME=PWRPPRD'

Note : Please make sure you create the directory named +ARCHIVES/PWRPPRD/STANDBY in your logical standby ASM manaully.


4. Make the below change in production database :


alter system set log_archive_dest_3='service="PWRPPRD", LGWR ASYNC NOAFFIRM delay=0 OPTIONAL max_failure=10 max_connections=1 reopen=15 db_unique_name="PWRPPRD" register net_timeout=180 valid_for=(online_logfile,primary_role)' scope=both sid='*';

Note : Starting shipping the logs from production and start applying it .

Conversion of physical standby to Logical

5. Cancel the managed Recovery at DR Database ( Logical db )

6. Make the below executions in Production database :

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG
DATA (PRIMARY KEY, uNIQUE INDEX) COLUMNS;

Database altered.

SQL> execute dbms_logstdby.build;

PL/SQL procedure successfully completed.

7. In the New logical Standby , Please convert the database into Single instance .


SQL> alter system set cluster_database=FALSE scope=spfile sid='*'
System altered.

SQL> shut immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.

Total System Global Area 4294967296 bytes
Fixed Size 2133936 bytes
Variable Size 810938448 bytes
Database Buffers 3456106496 bytes
Redo Buffers 25788416 bytes
SQL> alter database mount standby database;

Database altered.


8. Now issue the command to switch the Physical dr to logical DR :

SQL> alter database recover to logical standby PWRPPRD;

Note :

Please run the below script in the DR side :

select process,status,client_process,sequence#,block#,active_agents,known_agents
from v$managed_standby;

the above script will show you the logfile for which DR is waiting. After running the logical conversion command. go to
the production database and backup the log file which the above script show and scp it to the new DR and
register it in this side. Do the same method of couple of time until the above command gets altered.

Reason being , the conversion command requires all the log till we made the logical build in the production to recover
and convert it.


Note : At this point the conversion command will change the DB name and also it will update in the Spfile. Also alert log you
will find the below messages .


Converting standby mount to primary mount.
Tue Mar 4 02:41:00 2008
ACTIVATE STANDBY: Complete - Database mounted as primary (PWRPPRD1)
*** DBNEWID utility started ***
DBID will be changed from 505738321 to new DBID of 2131768892 for database PWPRD
DBNAME will be changed from PWPRD to new DBNAME of PWRPPRD
Starting datafile conversion
Setting recovery target incarnation to 1
Datafile conversion complete
Database name changed to PWRPPRD.
Modify parameter file and generate a new password file before restarting.
Database ID for database PWRPPRD changed to 2131768892.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open with RESETLOGS option.
Succesfully changed database name and ID.
*** DBNEWID utility finished succesfully ***
Tue Mar 4 02:41:01 2008
SUCCESS: diskgroup RPT_DATA was dismounted
Tue Mar 4 02:41:01 2008
Completed: alter database recover to logical standby PWRPPRD

9. Make sure you alter the cluster database instance paramter to 2 and also cluster database to true before you shutdown .


alter system set cluster_database=TRUE scope=spfile sid='*';

10 . Bounce the logical standby and open it in reset logs mode.

11. Start shipping the logs from production side and start the logical real time apply.

Note : please add standby logfiles at logical standby side. To make real time apply.

Transport Transactional tablespace

From db01-lisprd

Create directory object for Data Pump

SQL> create directory pwprd_dir as '/d01/app/pwprd';

Directory created.

SQL> grant read, write on directory pwprd_dir to system;

Grant succeeded.

Bring HLPR tablespace to read only mode to facilitate transfer

SQL> alter tablespace hlpr read only;

Tablespace altered.

Export metadata for tablespace with Data Pump. We also choose the transport_full_check option so that Data Pump will check tablespace dependencies. This was already performed via SQL*Plus but is used here just as a precaution.

-bash-3.00$ expdp system/p1pathway dumpfile=hlpr.dmp directory=pwprd_dir transport_tablespaces=hlpr transport_full_check=y

Export: Release 10.2.0.1.0 - 64bit Production on Thursday, 28 September, 2006 11:25:38

Copyright (c) 2003, 2005, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
Starting "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01": system/******** dumpfile=hlpr.dmp directory=pwprd_dir transport_tablespaces=hlpr transport_full_check=y
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/INDEX
Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT
Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/REF_CONSTRAINT
Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Master table "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_TRANSPORTABLE_01 is:
/d01/app/pwprd/hlpr.dmp
Job "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" successfully completed at 11:26:22

Launch RMAN and use the convert command to capture the HLPR tablespace in a backupset.

-bash-3.00$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Thu Sep 28 11:26:49 2006

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: PWHLPR (DBID=691297521)

RMAN> convert tablespace hlpr format '/d01/app/pwprd/hlpr_%U';

Starting backup at 28-SEP-06
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=510 instance=PWHLPR1 devtype=DISK
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00006 name=+HLPR_DATA/pwhlpr/datafile/hlpr01.ora
converted datafile=/d01/app/pwprd/hlpr_data_D-PWHLPR_I-691297521_TS-HLPR_FNO-6_09hudqct
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:05:36
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00009 name=+HLPR_DATA/pwhlpr/datafile/hlpr.266.602275983
converted datafile=/d01/app/pwprd/hlpr_data_D-PWHLPR_I-691297521_TS-HLPR_FNO-9_0ahudqnd
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:01:35
Finished backup at 28-SEP-06

Move all files to rptdb01-lisprd.ftw


From rptdb01-lisprd

-bash-3.00$ ls -lrt
total 68248184
drwxrwx--- 3 pwrpprd pdba 512 Sep 21 11:18 product
-rw-r----- 1 pwrpprd pdba 385024 Sep 28 12:43 hlpr.dmp
-rw-r----- 1 pwrpprd pdba 26214408192 Sep 28 13:12 hlpr_data_D-PWHLPR_I-691297521_TS-HLPR_FNO-6_09hudqct
-rw-r----- 1 pwrpprd pdba 8560648192 Sep 28 13:21 hlpr_data_D-PWHLPR_I-691297521_TS-HLPR_FNO-9_0ahudqnd
-rw-r----- 1 pwrpprd pdba 150499328 Sep 28 13:22 pathway.dmp
-rw-rw-r-- 1 pwrpprd pdba 26767 Sep 28 13:38 import.log
-bash-3.00$
-bash-3.00$ rman target /

Recovery Manager: Release 10.2.0.2.0 - Production on Thu Sep 28 13:39:23 2006

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: PWHLPR (DBID=693046759)

RMAN> convert datafile '/d01/app/pwrpprd/hlpr_data_D-PWHLPR_I-691297521_TS-HLPR_FNO-6_09hudqct',
2> '/d01/app/pwrpprd/hlpr_data_D-PWHLPR_I-691297521_TS-HLPR_FNO-9_0ahudqnd'
3> format '+HLPR_DATA';

Starting backup at 28-SEP-06
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=54 instance=PWHLPR1 devtype=DISK
channel ORA_DISK_1: starting datafile conversion
input filename=/d01/app/pwrpprd/hlpr_data_D-PWHLPR_I-691297521_TS-HLPR_FNO-6_09hudqct
converted datafile=+HLPR_DATA/pwhlpr/datafile/hlpr.262.602343695
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:09:45
channel ORA_DISK_1: starting datafile conversion
input filename=/d01/app/pwrpprd/hlpr_data_D-PWHLPR_I-691297521_TS-HLPR_FNO-9_0ahudqnd
converted datafile=+HLPR_DATA/pwhlpr/datafile/hlpr.263.602344281
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:02:56
Finished backup at 28-SEP-06

-bash-3.00$ impdp system/pathway dumpfile=hlpr.dmp directory=pwprd_dir transport_datafiles='+HLPR_DATA/pwhlpr/datafile/hlpr.262.602343695','+HLPR_DATA/pwhlpr/datafile/hlpr.263.602344281'

Import: Release 10.2.0.2.0 - 64bit Production on Thursday, 28 September, 2006 14:05:30

Copyright (c) 2003, 2005, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
Master table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01": system/******** dumpfile=hlpr.dmp directory=pwprd_dir transport_datafiles=+HLPR_DATA/pwhlpr/datafile/hlpr.262.602343695,+HLPR_DATA/pwhlpr/datafile/hlpr.263.602344281
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/INDEX
Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT
Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/REF_CONSTRAINT
Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at 14:05:55

SQL> select * from v$tablespace;

TS# NAME INC BIG FLA ENC
---------- ------------------------------ --- --- --- ---
0 SYSTEM YES NO YES
1 UNDOTBS1 YES NO YES
2 SYSAUX YES NO YES
4 USERS YES NO YES
3 TEMP NO NO YES
5 UNDOTBS2 YES NO YES
6 HLPR YES NO YES

7 rows selected.

SQL> alter tablespace hlpr read write;

Tablespace altered.