1. Add entry in /etc/oratab if not already there
nghlab:/u01/app/oracle/product/11.2.0/db_1:Y
2. log in as root user -
go to /etc/init.d
3. Create a file called dbora as follows – (Note This works for the default LISTENER )
#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
ORA_HOME=/u01/app/oracle/product/11.2.0/db_1
ORA_OWNER=oracle
#LISTENER_NAME=LISTENER
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo “Oracle startup: cannot start”
exit
fi
case “$1″ in
‘start’)
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl start”
su – $ORA_OWNER -c $ORA_HOME/bin/dbstart
touch /var/lock/subsys/dbora
;;
‘stop’)
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su – $ORA_OWNER -c $ORA_HOME/bin/dbshut
su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl stop”
rm -f /var/lock/subsys/dbora
;;
esac
4. Change the Group and mode of dbora file -
[root@nghlab init.d]# chgrp dba dbora
[root@nghlab init.d]# chmod 750 dbora
5. Create Soft Link ( Appropriate Run level Script)
[root@nghlab init.d]# ln -s /etc/init.d/dbora /etc/rc.d/rc0.d/K01dbora
[root@nghlab init.d]# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
[root@nghlab init.d]# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora
6. TEST IT OUT -
REBOOT YOUR SERVER -
reboot -
OR Try -
/etc/init.d/dbora start
/etc/init.d/dbora stop
Search
Friday, November 16, 2012
Oracle 11gR2 RAC Services create/status/configure/relocate
How to see what services you have and where they are running:
[oracle@Rac1 ~]$ srvctl status service -d RAC
Service CONTACT is running on instance(s) RAC1
How to Add Service to your RAC database:
[oracle@Rac1 ~]$ srvctl add service -s NEWSRV -r RAC1 -a RAC2 -d RAC
[oracle@Rac1 ~]$ srvctl add service -s NEWSRV1 -d RAC -r rac1, rac2
How to see more detailed information about your service: (to view how services are actually configure on which nodes and which database respectively)
oracle@Rac1 ~]$ srvctl config service -s NEWSRV -d RAC
Service name: NEWSRV
Service is enabled
Server pool: RAC_NEWSRV
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Preferred instances: RAC1
Available instances: RAC2
[oracle@Rac1 ~]$ srvctl config service -s NEWSRV1 -d RAC
Service name: NEWSRV1
Service is enabled
Server pool: RAC_NEWSRV1
Cardinality: 2
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Preferred instances: RAC1,RAC2
Available instances:
How to Start your Service after creating it:
[oracle@Rac1 ~]$ srvctl start service -s NEWSRV -d RAC
[oracle@Rac1 ~]$ srvctl start service -s NEWSRV1 -d RAC
How to check if your service is registered:
oracle@Rac1 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 – Production on 16-JUN-2012 10:03:26
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 – Production
Start Date 16-JUN-2012 08:40:17
Uptime 0 days 1 hr. 23 min. 10 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/Rac1/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.103)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.113)(PORT=1521)))
Services Summary…
Service “+ASM” has 1 instance(s).
Instance “+ASM1″, status READY, has 1 handler(s) for this service…
Service “CONTACT.localdomain” has 1 instance(s).
Instance “RAC1″, status READY, has 1 handler(s) for this service…
Service “NEWSRV.localdomain” has 1 instance(s).
Instance “RAC1″, status READY, has 1 handler(s) for this service…
Service “NEWSRV1.localdomain” has 1 instance(s).
Instance “RAC1″, status READY, has 1 handler(s) for this service…
Service “RAC.localdomain” has 1 instance(s).
Instance “RAC1″, status READY, has 1 handler(s) for this service…
Service “RACXDB.localdomain” has 1 instance(s).
Instance “RAC1″, status READY, has 1 handler(s) for this service…
The command completed successfully
How to connect to your Service:
1) Add following tns entry in your tnsnames.ora
NEWSRV =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan-ip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = NEWSRV.localdomain)
)
)
2) connect thru sqlplus prompt
[oracle@Rac1 admin]$ sqlplus system@NEWSRV
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jun 16 10:12:49 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select host_name from v$instance;
HOST_NAME
—————————————————————-
Rac1.localdomain
How to Relocating Services:
1) Service will relocate to available instance if preferred instance becomes unavailable:
[oracle@Rac1 admin]$ ps -ef |grep smon
oracle 5346 1 0 08:39 ? 00:00:00 asm_smon_+ASM1
oracle 6245 1 0 08:40 ? 00:00:02 ora_smon_RAC1
oracle 16371 8720 0 10:13 pts/2 00:00:00 grep smon
[oracle@Rac1 admin]$ kill -9 6245
[oracle@Rac1 admin]$ ps -ef |grep smon
oracle 5346 1 0 08:39 ? 00:00:00 asm_smon_+ASM1
oracle 16488 8720 0 10:14 pts/2 00:00:00 grep smon
[oracle@Rac1 admin]$ srvctl status service -s NEWSRV -d RAC
Service NEWSRV is running on instance(s) RAC2( we can set this information using< srvctl configure.. > command
[oracle@Rac1 admin]$ sqlplus system@NEWSRV
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jun 16 10:14:42 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select host_name from v$instance;
HOST_NAME
—————————————————————-
Rac2.localdomain
2) You can manually relocate service back to original instance once it is back up:
[oracle@Rac1 admin]$ srvctl relocate service -s NEWSRV -d RAC -i RAC2 -t RAC1
[oracle@Rac1 admin]$ srvctl status service -s NEWSRV -d RAC
Service NEWSRV is running on instance(s) RAC1
[oracle@Rac1 ~]$ srvctl status service -d RAC
Service CONTACT is running on instance(s) RAC1
How to Add Service to your RAC database:
[oracle@Rac1 ~]$ srvctl add service -s NEWSRV -r RAC1 -a RAC2 -d RAC
[oracle@Rac1 ~]$ srvctl add service -s NEWSRV1 -d RAC -r rac1, rac2
How to see more detailed information about your service: (to view how services are actually configure on which nodes and which database respectively)
oracle@Rac1 ~]$ srvctl config service -s NEWSRV -d RAC
Service name: NEWSRV
Service is enabled
Server pool: RAC_NEWSRV
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Preferred instances: RAC1
Available instances: RAC2
[oracle@Rac1 ~]$ srvctl config service -s NEWSRV1 -d RAC
Service name: NEWSRV1
Service is enabled
Server pool: RAC_NEWSRV1
Cardinality: 2
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Preferred instances: RAC1,RAC2
Available instances:
How to Start your Service after creating it:
[oracle@Rac1 ~]$ srvctl start service -s NEWSRV -d RAC
[oracle@Rac1 ~]$ srvctl start service -s NEWSRV1 -d RAC
How to check if your service is registered:
oracle@Rac1 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 – Production on 16-JUN-2012 10:03:26
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 – Production
Start Date 16-JUN-2012 08:40:17
Uptime 0 days 1 hr. 23 min. 10 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/Rac1/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.103)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.113)(PORT=1521)))
Services Summary…
Service “+ASM” has 1 instance(s).
Instance “+ASM1″, status READY, has 1 handler(s) for this service…
Service “CONTACT.localdomain” has 1 instance(s).
Instance “RAC1″, status READY, has 1 handler(s) for this service…
Service “NEWSRV.localdomain” has 1 instance(s).
Instance “RAC1″, status READY, has 1 handler(s) for this service…
Service “NEWSRV1.localdomain” has 1 instance(s).
Instance “RAC1″, status READY, has 1 handler(s) for this service…
Service “RAC.localdomain” has 1 instance(s).
Instance “RAC1″, status READY, has 1 handler(s) for this service…
Service “RACXDB.localdomain” has 1 instance(s).
Instance “RAC1″, status READY, has 1 handler(s) for this service…
The command completed successfully
How to connect to your Service:
1) Add following tns entry in your tnsnames.ora
NEWSRV =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan-ip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = NEWSRV.localdomain)
)
)
2) connect thru sqlplus prompt
[oracle@Rac1 admin]$ sqlplus system@NEWSRV
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jun 16 10:12:49 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select host_name from v$instance;
HOST_NAME
—————————————————————-
Rac1.localdomain
How to Relocating Services:
1) Service will relocate to available instance if preferred instance becomes unavailable:
[oracle@Rac1 admin]$ ps -ef |grep smon
oracle 5346 1 0 08:39 ? 00:00:00 asm_smon_+ASM1
oracle 6245 1 0 08:40 ? 00:00:02 ora_smon_RAC1
oracle 16371 8720 0 10:13 pts/2 00:00:00 grep smon
[oracle@Rac1 admin]$ kill -9 6245
[oracle@Rac1 admin]$ ps -ef |grep smon
oracle 5346 1 0 08:39 ? 00:00:00 asm_smon_+ASM1
oracle 16488 8720 0 10:14 pts/2 00:00:00 grep smon
[oracle@Rac1 admin]$ srvctl status service -s NEWSRV -d RAC
Service NEWSRV is running on instance(s) RAC2( we can set this information using< srvctl configure.. > command
[oracle@Rac1 admin]$ sqlplus system@NEWSRV
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jun 16 10:14:42 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select host_name from v$instance;
HOST_NAME
—————————————————————-
Rac2.localdomain
2) You can manually relocate service back to original instance once it is back up:
[oracle@Rac1 admin]$ srvctl relocate service -s NEWSRV -d RAC -i RAC2 -t RAC1
[oracle@Rac1 admin]$ srvctl status service -s NEWSRV -d RAC
Service NEWSRV is running on instance(s) RAC1
Thursday, November 15, 2012
Steps to verify the Consistant Backup using RMAN
All the commands used below do not perform an actual recovery , it only reads and validates the backups , what I do have to say though is that is the word VALIDATE is missing in some commands and depending on which state you have your DB , it will actually start to do the restore process, so be very careful that you include that word.
STEP 1:
Here are the commands I used for this exercise, also note that it doesn't matter if the channel you are allocating is to DISK or to SBT, in this case I used DISK
RESTORE DATABASE PREVIEW ;
RESTORE DATABASE VALIDATE;
RESTORE ARCHIVELOG FROM sequence xx UNTIL SEQUENCE yy THREAD nn VALIDATE;
RESTORE CONTROLFILE VALIDATE;
RESTORE SPFILE VALIDATE;
The first thing that you have to do is, if you are not going to use the latest backup, define the time that you want to validate your backup, the first command that we are going to use is RESTORE . . . PREVIEW, this command identifies the needed backup(s) to execute the restore process as well as the Archived Redo Logs needed.
RMAN> RUN
2> {
3> set until time "to_date('03-SEP-201222:20:00','dd-mm-yyyyhh24:mi:ss')";
4> allocate channel ch1 device type disk ;
5> RESTORE DATABASE PREVIEW ;
6> }
executing command: SET until clause
allocated channel: ch1
channel ch1: SID=158 instance=TESTDB1 device type=DISK
Starting restore at 03-SEP-2012 22:54:18
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ --------------------
6 Full 75.34M DISK 00:00:19 03-SEP-2012 22:01:04
BP Key: 6 Status: AVAILABLE Compressed: YES Tag: TESTDB_HOT_0904_2100
Piece Name: /mount/copy01/TESTDB/oracle/TESTDB/full/TESTDB_HOT_09032012_1_6_793058445
List of Datafiles in backup set 6
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- -------------------- ----
1 Full 224235 03-SEP-2012 22:00:46 +DATA/TESTDB/datafile/system01.dbf
2 Full 224235 03-SEP-2012 22:00:46 +DATA/TESTDB/datafile/sysaux01.dbf
3 Full 224235 03-SEP-2012 22:00:46 +DATA/TESTDB/datafile/undotbs1_01.dbf
4 Full 224235 03-SEP-2012 22:00:46 +DATA/TESTDB/datafile/undotbs2_01.dbf
5 Full 224235 03-SEP-2012 22:00:46 +DATA/TESTDB/datafile/users_01.dbf
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ --------------------
9 482.00K DISK 00:00:00 03-SEP-2012 22:01:39
BP Key: 9 Status: AVAILABLE Compressed: YES Tag: TESTDB_ARCH_0904_2100
Piece Name: /mount/copy01/TESTDB/oracle/TESTDB/arch/TESTDB_ARCH_09032012_1_9_793058499
List of Archived Logs in backup set 9
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- -------------------- ---------- ---------
1 8 222449 03-SEP-2012 21:57:53 224442 03-SEP-2012 22:01:33
2 4 222452 03-SEP-2012 21:59:38 224448 03-SEP-2012 22:03:17
1 9 224442 03-SEP-2012 22:01:33 224456 03-SEP-2012 22:01:36
2 5 224448 03-SEP-2012 22:03:17 224459 03-SEP-2012 22:03:21
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ --------------------
12 389.50K DISK 00:00:01 03-SEP-2012 22:21:50
BP Key: 12 Status: AVAILABLE Compressed: YES Tag: TESTDB_ARCH_0904_22_20
Piece Name: /mount/copy01/TESTDB/oracle/TESTDB/full/0bnka8bt_1_1
List of Archived Logs in backup set 12
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- -------------------- ---------- ---------
1 10 224456 03-SEP-2012 22:01:36 225574 03-SEP-2012 22:21:01
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ --------------------
11 25.00K DISK 00:00:00 03-SEP-2012 22:21:50
BP Key: 11 Status: AVAILABLE Compressed: YES Tag: TESTDB_ARCH_0904_22_20
Piece Name: /mount/copy01/TESTDB/oracle/TESTDB/full/0cnka8bu_1_1
List of Archived Logs in backup set 11
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- -------------------- ---------- ---------
2 6 224459 03-SEP-2012 22:03:21 225577 03-SEP-2012 22:22:45
Media recovery start SCN is 224235
Recovery must be done beyond SCN 224235 to clear datafile fuzziness
Finished restore at 03-SEP-2012 22:55:15
released channel: ch1
STEP 2:
which is RESTORE DATABASE VALIDATE, it will read the pieces of the backup and if it finds an error it will report it.
RMAN> RUN
2> {
3> set until time "to_date('03-SEP-201222:20:00','dd-mm-yyyyhh24:mi:ss')";
4> allocate channel ch1 device type disk ;
5> restore database validate;
6> }
executing command: SET until clause
allocated channel: ch1
channel ch1: SID=158 instance=TESTDB1 device type=DISK
Starting restore at 03-SEP-2012 22:51:44
channel ch1: starting validation of datafile backup set
channel ch1: reading from backup piece /mount/copy01/TESTDB/oracle/TESTDB/full/TESTDB_HOT_09032012_1_6_793058445
channel ch1: piece handle=/mount/copy01/TESTDB/oracle/TESTDB/full/TESTDB_HOT_09032012_1_6_793058445 tag=TESTDB_HOT_0904_2100
channel ch1: restored backup piece 1
channel ch1: validation complete, elapsed time: 00:00:25
Finished restore at 03-SEP-2012 22:52:38
released channel: ch1
If you looked closely at the result above, this only read the backupset which contain the datafiles, not the Archived Redo Logs, so now we have to verify the integrity of these, as these will also be needed if the backup was an inconsistent backup (Hot Backup).
STEP 3:
What I recommend is that you get the value of the needed Archived Redo Logs from result of the RESTORE...PREVIEW, once you have these values, run the command RESTORE ARCHIVELOG. . . VALIDATE
RMAN> RUN
2> {
3> allocate channel ch1 type disk;
4> restore archivelog from sequence 8 until sequence 10 thread 1 validate;
5> restore archivelog from sequence 4 until sequence 6 thread 2 validate;
6> }
allocated channel: ch1
channel ch1: SID=158 instance=TESTDB1 device type=DISK
Starting restore at 03-SEP-2012 23:15:11
channel ch1: starting validation of archived log backup set
channel ch1: reading from backup piece /mount/copy01/TESTDB/oracle/TESTDB/arch/TESTDB_ARCH_09032012_1_9_793058499
channel ch1: piece handle=/mount/copy01/TESTDB/oracle/TESTDB/arch/TESTDB_ARCH_09032012_1_9_793058499 tag=TESTDB_ARCH_0904_2100
channel ch1: restored backup piece 1
channel ch1: validation complete, elapsed time: 00:00:01
channel ch1: starting validation of archived log backup set
channel ch1: reading from backup piece /mount/copy01/TESTDB/oracle/TESTDB/full/0bnka8bt_1_1
channel ch1: piece handle=/mount/copy01/TESTDB/oracle/TESTDB/full/0bnka8bt_1_1 tag=TESTDB_ARCH_0904_22_20
channel ch1: restored backup piece 1
channel ch1: validation complete, elapsed time: 00:00:01
Finished restore at 03-SEP-2012 23:15:15
Starting restore at 03-SEP-2012 23:15:17
channel ch1: starting validation of archived log backup set
channel ch1: reading from backup piece /mount/copy01/TESTDB/oracle/TESTDB/arch/TESTDB_ARCH_09032012_1_9_793058499
channel ch1: piece handle=/mount/copy01/TESTDB/oracle/TESTDB/arch/TESTDB_ARCH_09032012_1_9_793058499 tag=TESTDB_ARCH_0904_2100
channel ch1: restored backup piece 1
channel ch1: validation complete, elapsed time: 00:00:01
channel ch1: starting validation of archived log backup set
channel ch1: reading from backup piece /mount/copy01/TESTDB/oracle/TESTDB/full/0cnka8bu_1_1
channel ch1: piece handle=/mount/copy01/TESTDB/oracle/TESTDB/full/0cnka8bu_1_1 tag=TESTDB_ARCH_0904_22_20
channel ch1: restored backup piece 1
channel ch1: validation complete, elapsed time: 00:00:01
Finished restore at 03-SEP-2012 23:15:21
released channel: ch1
STEP 4:
To end this , we just need to validate that we can restore the control file and our binary parameter file
RMAN> RUN
2> {
3> allocate channel ch1 type disk;
4> set until time "to_date('03-SEP-201222:20:00','dd-mm-yyyyhh24:mi:ss')";
5> restore controlfile validate;
6> restore spfile validate;
7> }
allocated channel: ch1
channel ch1: SID=158 instance=TESTDB1 device type=DISK
executing command: SET until clause
Starting restore at 03-SEP-2012 23:23:14
channel ch1: starting validation of datafile backup set
channel ch1: reading from backup piece /mount/copy01/TESTDB/oracle/TESTDB/control/c-3899479525-20120903-03
channel ch1: piece handle=/mount/copy01/TESTDB/oracle/TESTDB/control/c-3899479525-20120903-03 tag=TAG20120903T220143
channel ch1: restored backup piece 1
channel ch1: validation complete, elapsed time: 00:00:01
Finished restore at 03-SEP-2012 23:23:15
Starting restore at 03-SEP-2012 23:23:16
channel ch1: starting validation of datafile backup set
channel ch1: reading from backup piece /mount/copy01/TESTDB/oracle/TESTDB/control/c-3899479525-20120903-04
channel ch1: piece handle=/mount/copy01/TESTDB/oracle/TESTDB/control/c-3899479525-20120903-04 tag=TAG20120903T222152
channel ch1: restored backup piece 1
channel ch1: validation complete, elapsed time: 00:00:01
Finished restore at 03-SEP-2012 23:23:18
released channel: ch1
STEP 1:
Here are the commands I used for this exercise, also note that it doesn't matter if the channel you are allocating is to DISK or to SBT, in this case I used DISK
RESTORE DATABASE PREVIEW ;
RESTORE DATABASE VALIDATE;
RESTORE ARCHIVELOG FROM sequence xx UNTIL SEQUENCE yy THREAD nn VALIDATE;
RESTORE CONTROLFILE VALIDATE;
RESTORE SPFILE VALIDATE;
The first thing that you have to do is, if you are not going to use the latest backup, define the time that you want to validate your backup, the first command that we are going to use is RESTORE . . . PREVIEW, this command identifies the needed backup(s) to execute the restore process as well as the Archived Redo Logs needed.
RMAN> RUN
2> {
3> set until time "to_date('03-SEP-201222:20:00','dd-mm-yyyyhh24:mi:ss')";
4> allocate channel ch1 device type disk ;
5> RESTORE DATABASE PREVIEW ;
6> }
executing command: SET until clause
allocated channel: ch1
channel ch1: SID=158 instance=TESTDB1 device type=DISK
Starting restore at 03-SEP-2012 22:54:18
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ --------------------
6 Full 75.34M DISK 00:00:19 03-SEP-2012 22:01:04
BP Key: 6 Status: AVAILABLE Compressed: YES Tag: TESTDB_HOT_0904_2100
Piece Name: /mount/copy01/TESTDB/oracle/TESTDB/full/TESTDB_HOT_09032012_1_6_793058445
List of Datafiles in backup set 6
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- -------------------- ----
1 Full 224235 03-SEP-2012 22:00:46 +DATA/TESTDB/datafile/system01.dbf
2 Full 224235 03-SEP-2012 22:00:46 +DATA/TESTDB/datafile/sysaux01.dbf
3 Full 224235 03-SEP-2012 22:00:46 +DATA/TESTDB/datafile/undotbs1_01.dbf
4 Full 224235 03-SEP-2012 22:00:46 +DATA/TESTDB/datafile/undotbs2_01.dbf
5 Full 224235 03-SEP-2012 22:00:46 +DATA/TESTDB/datafile/users_01.dbf
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ --------------------
9 482.00K DISK 00:00:00 03-SEP-2012 22:01:39
BP Key: 9 Status: AVAILABLE Compressed: YES Tag: TESTDB_ARCH_0904_2100
Piece Name: /mount/copy01/TESTDB/oracle/TESTDB/arch/TESTDB_ARCH_09032012_1_9_793058499
List of Archived Logs in backup set 9
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- -------------------- ---------- ---------
1 8 222449 03-SEP-2012 21:57:53 224442 03-SEP-2012 22:01:33
2 4 222452 03-SEP-2012 21:59:38 224448 03-SEP-2012 22:03:17
1 9 224442 03-SEP-2012 22:01:33 224456 03-SEP-2012 22:01:36
2 5 224448 03-SEP-2012 22:03:17 224459 03-SEP-2012 22:03:21
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ --------------------
12 389.50K DISK 00:00:01 03-SEP-2012 22:21:50
BP Key: 12 Status: AVAILABLE Compressed: YES Tag: TESTDB_ARCH_0904_22_20
Piece Name: /mount/copy01/TESTDB/oracle/TESTDB/full/0bnka8bt_1_1
List of Archived Logs in backup set 12
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- -------------------- ---------- ---------
1 10 224456 03-SEP-2012 22:01:36 225574 03-SEP-2012 22:21:01
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ --------------------
11 25.00K DISK 00:00:00 03-SEP-2012 22:21:50
BP Key: 11 Status: AVAILABLE Compressed: YES Tag: TESTDB_ARCH_0904_22_20
Piece Name: /mount/copy01/TESTDB/oracle/TESTDB/full/0cnka8bu_1_1
List of Archived Logs in backup set 11
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- -------------------- ---------- ---------
2 6 224459 03-SEP-2012 22:03:21 225577 03-SEP-2012 22:22:45
Media recovery start SCN is 224235
Recovery must be done beyond SCN 224235 to clear datafile fuzziness
Finished restore at 03-SEP-2012 22:55:15
released channel: ch1
STEP 2:
which is RESTORE DATABASE VALIDATE, it will read the pieces of the backup and if it finds an error it will report it.
RMAN> RUN
2> {
3> set until time "to_date('03-SEP-201222:20:00','dd-mm-yyyyhh24:mi:ss')";
4> allocate channel ch1 device type disk ;
5> restore database validate;
6> }
executing command: SET until clause
allocated channel: ch1
channel ch1: SID=158 instance=TESTDB1 device type=DISK
Starting restore at 03-SEP-2012 22:51:44
channel ch1: starting validation of datafile backup set
channel ch1: reading from backup piece /mount/copy01/TESTDB/oracle/TESTDB/full/TESTDB_HOT_09032012_1_6_793058445
channel ch1: piece handle=/mount/copy01/TESTDB/oracle/TESTDB/full/TESTDB_HOT_09032012_1_6_793058445 tag=TESTDB_HOT_0904_2100
channel ch1: restored backup piece 1
channel ch1: validation complete, elapsed time: 00:00:25
Finished restore at 03-SEP-2012 22:52:38
released channel: ch1
If you looked closely at the result above, this only read the backupset which contain the datafiles, not the Archived Redo Logs, so now we have to verify the integrity of these, as these will also be needed if the backup was an inconsistent backup (Hot Backup).
STEP 3:
What I recommend is that you get the value of the needed Archived Redo Logs from result of the RESTORE...PREVIEW, once you have these values, run the command RESTORE ARCHIVELOG. . . VALIDATE
RMAN> RUN
2> {
3> allocate channel ch1 type disk;
4> restore archivelog from sequence 8 until sequence 10 thread 1 validate;
5> restore archivelog from sequence 4 until sequence 6 thread 2 validate;
6> }
allocated channel: ch1
channel ch1: SID=158 instance=TESTDB1 device type=DISK
Starting restore at 03-SEP-2012 23:15:11
channel ch1: starting validation of archived log backup set
channel ch1: reading from backup piece /mount/copy01/TESTDB/oracle/TESTDB/arch/TESTDB_ARCH_09032012_1_9_793058499
channel ch1: piece handle=/mount/copy01/TESTDB/oracle/TESTDB/arch/TESTDB_ARCH_09032012_1_9_793058499 tag=TESTDB_ARCH_0904_2100
channel ch1: restored backup piece 1
channel ch1: validation complete, elapsed time: 00:00:01
channel ch1: starting validation of archived log backup set
channel ch1: reading from backup piece /mount/copy01/TESTDB/oracle/TESTDB/full/0bnka8bt_1_1
channel ch1: piece handle=/mount/copy01/TESTDB/oracle/TESTDB/full/0bnka8bt_1_1 tag=TESTDB_ARCH_0904_22_20
channel ch1: restored backup piece 1
channel ch1: validation complete, elapsed time: 00:00:01
Finished restore at 03-SEP-2012 23:15:15
Starting restore at 03-SEP-2012 23:15:17
channel ch1: starting validation of archived log backup set
channel ch1: reading from backup piece /mount/copy01/TESTDB/oracle/TESTDB/arch/TESTDB_ARCH_09032012_1_9_793058499
channel ch1: piece handle=/mount/copy01/TESTDB/oracle/TESTDB/arch/TESTDB_ARCH_09032012_1_9_793058499 tag=TESTDB_ARCH_0904_2100
channel ch1: restored backup piece 1
channel ch1: validation complete, elapsed time: 00:00:01
channel ch1: starting validation of archived log backup set
channel ch1: reading from backup piece /mount/copy01/TESTDB/oracle/TESTDB/full/0cnka8bu_1_1
channel ch1: piece handle=/mount/copy01/TESTDB/oracle/TESTDB/full/0cnka8bu_1_1 tag=TESTDB_ARCH_0904_22_20
channel ch1: restored backup piece 1
channel ch1: validation complete, elapsed time: 00:00:01
Finished restore at 03-SEP-2012 23:15:21
released channel: ch1
STEP 4:
To end this , we just need to validate that we can restore the control file and our binary parameter file
RMAN> RUN
2> {
3> allocate channel ch1 type disk;
4> set until time "to_date('03-SEP-201222:20:00','dd-mm-yyyyhh24:mi:ss')";
5> restore controlfile validate;
6> restore spfile validate;
7> }
allocated channel: ch1
channel ch1: SID=158 instance=TESTDB1 device type=DISK
executing command: SET until clause
Starting restore at 03-SEP-2012 23:23:14
channel ch1: starting validation of datafile backup set
channel ch1: reading from backup piece /mount/copy01/TESTDB/oracle/TESTDB/control/c-3899479525-20120903-03
channel ch1: piece handle=/mount/copy01/TESTDB/oracle/TESTDB/control/c-3899479525-20120903-03 tag=TAG20120903T220143
channel ch1: restored backup piece 1
channel ch1: validation complete, elapsed time: 00:00:01
Finished restore at 03-SEP-2012 23:23:15
Starting restore at 03-SEP-2012 23:23:16
channel ch1: starting validation of datafile backup set
channel ch1: reading from backup piece /mount/copy01/TESTDB/oracle/TESTDB/control/c-3899479525-20120903-04
channel ch1: piece handle=/mount/copy01/TESTDB/oracle/TESTDB/control/c-3899479525-20120903-04 tag=TAG20120903T222152
channel ch1: restored backup piece 1
channel ch1: validation complete, elapsed time: 00:00:01
Finished restore at 03-SEP-2012 23:23:18
released channel: ch1
RAC 11gR2 BackGround process startup sequence
Level 1: OHASD Spawns:
cssdagent - Agent responsible for spawning CSSD.
orarootagent - Agent responsible for managing all root owned ohasd resources.
oraagent - Agent responsible for managing all oracle owned ohasd resources.
cssdmonitor - Monitors CSSD and node health (along wth the cssdagent).
Level 2: OHASD rootagent spawns:
CSDD (ora.cssd) - Cluster Synchronization Services
CRSD(ora.crsd) - Primary daemon responsible for managing cluster resources.
CTSSD(ora.ctssd) - Cluster Time Synchronization Services Daemon
Diskmon(ora.diskmon)
ACFS (ASM Cluster File System) Drivers
Level 2: OHASD oraagent spawns:
MDNSD(ora.mdnsd) - Used for DNS lookup
GIPCD(ora.gipcd) - Used for inter-process and inter-node communication
GPNPD(ora.gpnpd) - Grid Plug & Play Profile Daemon
EVMD(ora.evmd) - Event Monitor Daemon
ASM(ora.asm) - Resource for monitoring ASM instances
Level 3: CRSD spawns:
orarootagent - Agent responsible for managing all root owned crsd resources.
oraagent - Agent responsible for managing all oracle owned crsd resources.
Level 4: CRSD rootagent spawns:
Network resource - To monitor the public network
SCAN VIP(s) - Single Client Access Name Virtual IPs
Node VIPs - One per node
ACFS Registery - For mounting ASM Cluster File System
GNS VIP (optional) - VIP for GNS
Level 4: CRSD oraagent spawns:
ASM Resouce - ASM Instance(s) resource
Diskgroup - Used for managing/monitoring ASM diskgroups.
DB Resource - Used for monitoring and managing the DB and instances
SCAN Listener - Listener for single client access name, listening on SCAN VIP
Listener - Node listener listening on the Node VIP
Services - Used for monitoring and managing services
ONS - Oracle Notification Service
eONS - Enhanced Oracle Notification Service
GSD - For 9i backward compatibility
GNS (optional) - Grid Naming Service - Performs name resolution
Subscribe to:
Posts (Atom)