SCENARIO
- We have 2 Node RAC or-11 and or-12
- Oracle Clusterware is installed and configured on both Nodes
- ASM instances are running on both nodes +ASM1 on Node 1 (or-11) and +ASM2 on Node 2 (or-12)
- 2 Disk groups +DBDATA and +DBFLASH are created on ASM and are mounted on both nodes
- We have disk rman backup of Oracle database on under directories
D:\rmanbackup\db (DATAFILES BACKUPSETS)
D:\rmanbackup\ar (ARCHIVELOG BACKUPSETS)
D:\rmanbackup\ctl (CONTROLFILE BACKUPSET)
----------------------------------------------
1. BACKUP SCRIPT TO RUN ON SOURCE DATABASE
----------------------------------------------
RUN {
ALLOCATE CHANNEL ch00 TYPE DISK FORMAT 'D:\rmanbackup\db\%d_DB_%u_%s_%p';
set controlfile autobackup format for device type disk to "D:\rmanbackup\ctl\cf_RCTEST.%F";
backup
filesperset 4
INCREMENTAL LEVEL 0 AS COMPRESSED BACKUPSET database;
sql "alter system archive log current";
release channel ch00;
ALLOCATE CHANNEL CH01 TYPE DISK FORMAT 'D:\RMANBACKUP\AR\al_%U';
backup
filesperset 4
AS COMPRESSED BACKUPSET archivelog all;
RELEASE CHANNEL CH01;
}
-------------------------------
2. CREATE PFILE FOR SINGLE INSTANCE
------------------------------
large_pool_size=100m
shared_pool_size=1024m
db_cache_size=300m
audit_file_dest='D:\app\inam\admin\homedb\adump'
audit_trail='db'
db_create_file_dest='+DBDATA'
compatible='11.2.0.0.0'
control_files='+dbdata/homedb/controlfile/control01.ctl'
db_block_size=8192
db_domain=''
db_name='homedb'
#db_recovery_file_dest='+DBFLASH'
#db_recovery_file_dest_size=10G
diagnostic_dest='D:\app\inam'
remote_login_passwordfile='exclusive'
-------------------------------
3. CREATE SID FOR SINGLE INSTANCE ON NODE 1
--------------------------------
C:\Users\farif>oradim -new -sid RCTEST
instance created
--------------------------------
3. RESTORE AND RECOVER DATABASE
-------------------------------
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\farif>set oracle_sid=RCTEST
C:\Users\farif>rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Mon Jun 3 13:33:24 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup nomount pfile=D:\rmanbackup\initRCTEST.ora
Oracle instance started
Total System Global Area 1553379328 bytes
Fixed Size 2255464 bytes
Variable Size 1224738200 bytes
Database Buffers 318767104 bytes
Redo Buffers 7618560 bytes
RMAN> restore controlfile from 'D:\rmanbackup\ctl\CF_RCTEST.C-1547250382-20130527-05
2> ;
3>
^C
C:\Users\farif>rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Mon Jun 3 13:37:01 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: RCTEST (not mounted)
RMAN> restore controlfile from 'D:\rmanbackup\ctl\CF_RCTEST.C-1547250382-20130527-05';
Starting restore at 03-JUN-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=790 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=+DBDATA/RCTEST/controlfile/control01.ctl
Finished restore at 03-JUN-13
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
run {
ALLOCATE CHANNEL ch00 device TYPE DISK;
set newname for datafile 1 to '+DBDATA';
set newname for datafile 2 to '+DBDATA';
set newname for datafile 3 to '+DBDATA';
set newname for datafile 4 to '+DBDATA';
set newname for datafile 5 to '+DBDATA';
set newname for datafile 6 to '+DBDATA';
set newname for datafile 7 to '+DBDATA';
set newname for datafile 8 to '+DBDATA';
set newname for datafile 9 to '+DBDATA';
set newname for datafile 10 to '+DBDATA';
set newname for datafile 11 to '+DBDATA';
set newname for datafile 12 to '+DBDATA';
set newname for datafile 13 to '+DBDATA';
set newname for datafile 14 to '+DBDATA';
set newname for datafile 15 to '+DBDATA';
set newname for datafile 16 to '+DBDATA';
set newname for datafile 17 to '+DBDATA';
restore database;
switch datafile all;
RELEASE CHANNEL ch00;
}
allocated channel: ch00
channel ch00: SID=790 device type=DISK
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 03-JUN-13
Starting implicit crosscheck backup at 03-JUN-13
Crosschecked 24 objects
Finished implicit crosscheck backup at 03-JUN-13
Starting implicit crosscheck copy at 03-JUN-13
Crosschecked 6 objects
Finished implicit crosscheck copy at 03-JUN-13
searching for all files in the recovery area
cataloging files...
no files cataloged
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00010 to +DBDATA
channel ch00: restoring datafile 00014 to +DBDATA
channel ch00: restoring datafile 00017 to +DBDATA
channel ch00: reading from backup piece D:\RMANBACKUP\DB\RCTEST_DB_T3OALUOM_7075_1
channel ch00: piece handle=D:\RMANBACKUP\DB\RCTEST_DB_T3OALUOM_7075_1 tag=TAG20130527T084925
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:07:25
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00004 to +DBDATA
channel ch00: restoring datafile 00008 to +DBDATA
channel ch00: restoring datafile 00013 to +DBDATA
channel ch00: restoring datafile 00016 to +DBDATA
channel ch00: reading from backup piece D:\RMANBACKUP\DB\RCTEST_DB_T4OALV4E_7076_1
channel ch00: piece handle=D:\RMANBACKUP\DB\RCTEST_DB_T4OALV4E_7076_1 tag=TAG20130527T084925
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:07:55
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00001 to +DBDATA
channel ch00: restoring datafile 00002 to +DBDATA
channel ch00: restoring datafile 00007 to +DBDATA
channel ch00: restoring datafile 00015 to +DBDATA
channel ch00: reading from backup piece D:\RMANBACKUP\DB\RCTEST_DB_T5OALVHE_7077_1
channel ch00: piece handle=D:\RMANBACKUP\DB\RCTEST_DB_T5OALVHE_7077_1 tag=TAG20130527T084925
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:10:57
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00003 to +DBDATA
channel ch00: restoring datafile 00005 to +DBDATA
channel ch00: restoring datafile 00011 to +DBDATA
channel ch00: reading from backup piece D:\RMANBACKUP\DB\RCTEST_DB_T6OAM084_7078_1
channel ch00: piece handle=D:\RMANBACKUP\DB\RCTEST_DB_T6OAM084_7078_1 tag=TAG20130527T084925
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:06:45
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00006 to +DBDATA
channel ch00: restoring datafile 00009 to +DBDATA
channel ch00: restoring datafile 00012 to +DBDATA
channel ch00: reading from backup piece D:\RMANBACKUP\DB\RCTEST_DB_T7OAM0KQ_7079_1
channel ch00: piece handle=D:\RMANBACKUP\DB\RCTEST_DB_T7OAM0KQ_7079_1 tag=TAG20130527T084925
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:07:06
Finished restore at 03-JUN-13
datafile 1 switched to datafile copy
input datafile copy RECID=22 STAMP=817136383 file name=+DBDATA/RCTEST/datafile/system.285.817134897
datafile 2 switched to datafile copy
input datafile copy RECID=23 STAMP=817136384 file name=+DBDATA/RCTEST/datafile/sysaux.284.817134899
datafile 3 switched to datafile copy
input datafile copy RECID=24 STAMP=817136384 file name=+DBDATA/RCTEST/datafile/undotbs1.304.817135555
datafile 4 switched to datafile copy
input datafile copy RECID=25 STAMP=817136384 file name=+DBDATA/RCTEST/datafile/users.296.817134423
datafile 5 switched to datafile copy
input datafile copy RECID=26 STAMP=817136385 file name=+DBDATA/RCTEST/datafile/example.286.817135557
datafile 6 switched to datafile copy
input datafile copy RECID=27 STAMP=817136385 file name=+DBDATA/RCTEST/datafile/undotbs2.302.817135959
datafile 7 switched to datafile copy
input datafile copy RECID=28 STAMP=817136385 file name=+DBDATA/RCTEST/datafile/mohelog.283.817134899
datafile 8 switched to datafile copy
input datafile copy RECID=29 STAMP=817136385 file name=+DBDATA/RCTEST/datafile/testt_netbkup.291.817134425
datafile 9 switched to datafile copy
input datafile copy RECID=30 STAMP=817136385 file name=+DBDATA/RCTEST/datafile/recop1.263.817135963
datafile 10 switched to datafile copy
input datafile copy RECID=31 STAMP=817136386 file name=+DBDATA/RCTEST/datafile/mohelog.292.817133979
datafile 11 switched to datafile copy
input datafile copy RECID=32 STAMP=817136386 file name=+DBDATA/RCTEST/datafile/mohe.282.817135551
datafile 12 switched to datafile copy
input datafile copy RECID=33 STAMP=817136386 file name=+DBDATA/RCTEST/datafile/mohe.303.817135957
datafile 13 switched to datafile copy
input datafile copy RECID=34 STAMP=817136387 file name=+DBDATA/RCTEST/datafile/mohe.288.817134419
datafile 14 switched to datafile copy
input datafile copy RECID=35 STAMP=817136387 file name=+DBDATA/RCTEST/datafile/mohe.294.817133973
datafile 15 switched to datafile copy
input datafile copy RECID=36 STAMP=817136387 file name=+DBDATA/RCTEST/datafile/mohe.290.817134895
datafile 16 switched to datafile copy
input datafile copy RECID=37 STAMP=817136387 file name=+DBDATA/RCTEST/datafile/undotbs1.287.817134421
datafile 17 switched to datafile copy
input datafile copy RECID=38 STAMP=817136388 file name=+DBDATA/RCTEST/datafile/undotbs2.293.817133977
released channel: ch00
RMAN> recover database;
Starting recover at 03-JUN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=790 device type=DISK
starting media recovery
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=30908
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=28345
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=30909
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=28346
channel ORA_DISK_1: reading from backup piece D:\RMANBACKUP\AR\AL_T9OAM139_1_1
channel ORA_DISK_1: piece handle=D:\RMANBACKUP\AR\AL_T9OAM139_1_1 tag=TAG20130527T092913
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
archived log file name=+DBFLASH/RCTEST/archivelog/2013_06_03/thread_1_seq_30908.2859.817159709 thread=1 sequence=30908
archived log file name=+DBFLASH/RCTEST/archivelog/2013_06_03/thread_2_seq_28345.2857.817159709 thread=2 sequence=28345
channel default: deleting archived log(s)
archived log file name=+DBFLASH/RCTEST/archivelog/2013_06_03/thread_1_seq_30908.2859.817159709 RECID=59260 STAMP=817159714
archived log file name=+DBFLASH/RCTEST/archivelog/2013_06_03/thread_1_seq_30909.2862.817159709 thread=1 sequence=30909
channel default: deleting archived log(s)
archived log file name=+DBFLASH/RCTEST/archivelog/2013_06_03/thread_2_seq_28345.2857.817159709 RECID=59261 STAMP=817159717
archived log file name=+DBFLASH/RCTEST/archivelog/2013_06_03/thread_2_seq_28346.2860.817159709 thread=2 sequence=28346
channel default: deleting archived log(s)
archived log file name=+DBFLASH/RCTEST/archivelog/2013_06_03/thread_1_seq_30909.2862.817159709 RECID=59258 STAMP=817159710
unable to find archived log
archived log thread=1 sequence=30910
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 06/03/2013 20:48:49
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 30910 and starting SCN of 2214806534
RMAN> alter database open resetlogs;
database opened
-------------------------------------------
4. ADD TEMPFILE TO DATABASE AND DELETE OLD FILE INFO
-------------------------------------------
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '+DBDATA';
Tablespace altered.
SQL> SELECT NAME FROM V$TEMPFILE;
NAME
--------------------------------------------
+RCTESTDATA/RCTEST/tempfile/temp.263.770482269
+DBDATA/RCTEST/tempfile/temp.268.817160463
--------------------------------------------
SQL> alter tablespace temp drop tempfile '+RCTESTDATA/RCTEST/tempfile/temp.263.770482269';
Tablespace altered.
------------------------------------------
5. ADD RAC PARAMETERS TO PARAMETER FILE
------------------------------------------
large_pool_size=100m
shared_pool_size=1024m
db_cache_size=300m
audit_file_dest='D:\app\inam\admin\RCTEST\adump'
audit_trail='db'
db_create_file_dest='+DBDATA'
compatible='11.2.0.0.0'
control_files='+dbdata/RCTEST/controlfile/control01.ctl'
#CONTROL_FILES='D:\app\Inam\fast_recovery_area\RCTEST\CONTROL01.CTL'
db_block_size=8192
db_domain=''
db_name='RCTEST'
db_recovery_file_dest='+DBFLASH'
db_recovery_file_dest_size=10G
diagnostic_dest='D:\app\inam'
remote_login_passwordfile='exclusive'
RCTEST1.instance_number=1
RCTEST2.instance_number=2
cluster_database=true
cluster_database_instances=2
RCTEST1.thread=1
RCTEST2.thread=2
-----------------------------------------
6. CREATE SPFILE ON ASM FROM PFILE
----------------------------------------
SQL> create spfile='+DBDATA' from pfile='D:\rmanbackup\initRCTEST.ora';
File created.
----------------------------------------
7. VERIFY THAT FILE IS CREATED ON ASM
---------------------------------------
ASMCMD [+dbdata] > cd +dbdata/RCTEST/parameterfile
ASMCMD [+dbdata/RCTEST/parameterfile] > ls
spfile.267.817161073
---------------------------------------
8. CREATE PFILE ON BOTH NODES
---------------------------------------
create parameter files in ORACLE_HOME/database folder for both instances on both servers (initRCTEST1.ora on Node1 and init initRCTEST2.ora on node 2)
Add only one line in both files.
SPFILE='+DBDATA/RCTEST/parameterfile/spfile.267.817161073'
-------------------------------------
9.SHUTDOWN DATABASE
------------------------------------
SQL> shutdown immediate;
database closed
database dismounted
Oracle instance shut down
-----------------------------------
10. ADD DATABASE TO CLUSTER
-----------------------------------
Go to Grid home
cd D:\app\11.2.0.3\grid\BIN
Add database to cluster
D:\app\11.2.0.3\grid\BIN>srvctl add database -d RCTEST -o D:\app\Inam\product\11.2.0.3\dbhome_1
-----------------------------------
11. CHECK DATABASE IS ADDED TO CLUSTER OR NOT
-----------------------------------
D:\app\11.2.0.3\grid\BIN>srvctl config database -d RCTEST
Database unique name: RCTEST
Database name:
Oracle home: D:\app\Inam\product\11.2.0.3\dbhome_1
Oracle user: nt authority\system
Spfile:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: RCTEST
Database instances:
Disk Groups:
Mount point paths:
Services:
Type: RAC
Database is administrator managed
-----------------------------------------
12. ADD RAC INSTANCES
-----------------------------------------
D:\app\11.2.0.3\grid\BIN>srvctl add instance -d RCTEST -i RCTEST1 -n P-HQ-CL-OR-11
D:\app\11.2.0.3\grid\BIN>srvctl add instance -d RCTEST -i RCTEST2 -n P-HQ-CL-OR-12
------------------------------------------
13. VERIFY THAT INTANCES ARE ADDED TO CLUSTER
------------------------------------------
D:\app\11.2.0.3\grid\BIN>srvctl config database -d RCTEST
Database unique name: RCTEST
Database name:
Oracle home: D:\app\Inam\product\11.2.0.3\dbhome_1
Oracle user: nt authority\system
Spfile:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: RCTEST
Database instances: RCTEST1,RCTEST2
Disk Groups:
Mount point paths:
Services:
Type: RAC
Database is administrator managed
-----------------------------------------
14. START DATABASE
-----------------------------------------
D:\app\11.2.0.3\grid\BIN>srvctl start database -d RCTEST
----------------------------------------
15. VERIFY THAT DATABASE AND INSTANCES ARE UP
----------------------------------------
D:\app\11.2.0.3\grid\BIN>srvctl config database -d RCTEST
Database unique name: RCTEST
Database name:
Oracle home: D:\app\Inam\product\11.2.0.3\dbhome_1
Oracle user: nt authority\system
Spfile:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: RCTEST
Database instances: RCTEST1,RCTEST2
Disk Groups: DBDATA,DBFLASH
Mount point paths:
Services:
Type: RAC
Database is administrator managed
--------------------------------------
CHECK CLUSTER RESOURCE ora.RCTEST.db status (you can use your database)
--------------------------------------
D:\app\11.2.0.3\grid\BIN>crsctl status res ora.RCTEST.db -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.RCTEST.db
1 ONLINE ONLINE p-hq-cl-or-11 Open
2 ONLINE ONLINE p-hq-cl-or-12 Open
--------------------------------------
VERIFY FROM SQLPLUS
--------------------------------------
SQL> select instance_number,status,instance_name,host_name from gv$instance;
INSTANCE_NUMBER STATUS INSTANCE_NAME HOST_NAME
--------------- ------------ ---------------- --------------------------------
1 OPEN RCTEST1 P-HQ-CL-OR-11
2 OPEN RCTEST2 P-HQ-CL-OR-12
-------------------------------------
15. NETWORK CONFIGURATION
------------------------------------
Change this parameter
SQL> alter system set remote_listener='mohecrs-scan.mohe.gov.sa:1521' sid='*';
----------------------------------------
LISTENER.ORA on node1
(SID_DESC =
(GLOBAL_DBNAME = rctest)
(ORACLE_HOME = D:\app\Inam\product\11.2.0.3\dbhome_1)
(SERVICE_NAME = rctest)
(SID_NAME = rctest1)
)
---------------------------------------
LISTENER.ORA on node2
(SID_DESC =
(GLOBAL_DBNAME = rctest)
(ORACLE_HOME = D:\app\Inam\product\11.2.0.3\dbhome_1)
(SERVICE_NAME = rctest)
(SID_NAME = rctest2)
)
-------------------------------------
C:\Users\farif>set oracle_sid=D:\app\Inam\product\11.2.0.3\dbhome_1
C:\Users\farif>lsnrctl
LSNRCTL> reload
---------------------------------------------
TNSNAME.ORA on both nodes
rctest =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = mohecrs-scan.mohe.gov.sa)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rctest)
)
)
rctest1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.26.11)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rctest) (SID_NAME = rctest1)
)
)
rctest2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.26.12)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rctest) (SID_NAME = rctest2)
)
)
No comments:
Post a Comment