Académique Documents
Professionnel Documents
Culture Documents
Home
Oracle DB
SQL Server DB
Oracle 12c DB
Heterogeneous Services
My Resume
1.
FEB
How to Go About
Get DBID of the Database
Restoring SPFILE from Autobackups
Edit the Restored SPFILE
Restoring ControlFile from Autobackups
Catalog Backup Files
Get the Structure of Datafiles and Redo Log
Prepare and Execute the Restoration Script
Recover the Database Instance
Open the Database with RESETLOGS Option
You must set DBID prior to execute the command to restore the SPFILE and ControlFile from
autobackups. It is the best practice to keep in the safe place a record of DBID of your database.
Alternatively if you have autobackup of control file created with substitution variable %F in
the FORMAT clause you can find the DBID of the database. The variable %F is translated into cIIIIIIIIII-YYYYMMDD-QQ where
IIIIIIII is the DBID
YYYYMMDD is a time stamp of the day the backup is generated
159019008 bytes
1335192 bytes
75497576 bytes
79691776 bytes
2494464 bytes
Set RMAN CONTROLFILE AUTOBACKUP FORMAT parameter to the format mode used during
control file auto backup before you run RESTORE SPFILE FROM AUTOBACKUP command. It
important you have kept these RMAN information in safe place as part of your backup and recovery
strategy for the smooth disaster recover.
RMAN> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
'/u01/OraBkps/pcbdbcf_%F';
After restoration of SPFILE from autobackup you need to edit some setting to reflect the new
environment because it possible that the structure of the new server is not the same as the old
server. So shutdown the nomounted database instance then export the binary SPFILE settings to
text PFILE as follows
RMAN> shutdown immediate;
Oracle instance shut down
RMAN>
[oracle@Lugao-srv03 OraBkps]$ export ORACLE_SID=PCBDB
[oracle@Lugao-srv03 OraBkps]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 2 19:41:30 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create pfile='/home/oracle/initPDBDB.ora' from spfile;
File created.
PCBDB.__shared_pool_size=226492416
PCBDB.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/PCBDB/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/PCBDB/log/control01.ctl','/u02/PCBDB/log/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='PCBDB'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=PCBDBXDB)'
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=848297984
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
Create the missing file system on the new server, export back the PFILE settings to SPFILE then
start the database instance in nomount state
[oracle@Lugao-srv03 OraBkps]$ mkdir -p /u01/app/oracle/admin/PCBDB/adump
[oracle@Lugao-srv03 OraBkps]$ mkdir -p /u01/PCBDB/log
[oracle@Lugao-srv03 OraBkps]$ mkdir -p /u02/PCBDB/log
[oracle@Lugao-srv03 OraBkps]$ mkdir -p /u01/app/oracle/flash_recovery_area
[oracle@Lugao-srv03 OraBkps]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 2 19:41:30 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile='/home/oracle/initPDBDB.ora';
File created.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 849530880 bytes
Fixed Size
1339824 bytes
Variable Size
499125840 bytes
Database Buffers
343932928 bytes
Redo Buffers
5132288 bytes
FORMAT parameter to the format mode used during control file autobackup then execute RESTORE
CONTROLFILE FROM AUTOBACKUP command as follows
[oracle@Lugao-srv03 ~]$ export ORACLE_SID=PCBDB
[oracle@Lugao-srv03 ~]$ rman target/
Recovery Manager: Release 11.2.0.1.0 - Production on Mon Feb 2 20:02:37 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: PCBDB (not mounted)
RMAN> set dbid 132566208;
executing command: SET DBID
RMAN> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
'/u01/OraBkps/pcbdbcf_%F';
executing command: SET CONTROLFILE AUTOBACKUP FORMAT
RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;
Starting restore at 02-FEB-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
recovery area destination: /u01/app/oracle/flash_recovery_area
database name (or database unique name) used for search: PCBDB
channel ORA_DISK_1: no AUTOBACKUPS found in the recovery area
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150202
channel ORA_DISK_1: AUTOBACKUP found: /u01/OraBkps/pcbdbcf_c-132566208-2015020209
channel ORA_DISK_1: restoring control file from AUTOBACKUP /u01/OraBkps/pcbdbcf_c132566208-20150202-09
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=/u01/PCBDB/log/control01.ctl
output file name=/u02/PCBDB/log/control02.ctl
Finished restore at 02-FEB-15
It is possible that the backup files on new server are accessible through the location not yet known to
the restored control file thus you may need to catalog them. So mount the database instance then
execute the CATALOG command as follows
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN> catalog start with '/u01/OraBkps/backupset';
File Name:
/u01/OraBkps/backupset/2015_02_02/o1_mf_annnn_TAG20150202T121347_bdyhycwx_.bkp
Prepare the RMAN script that include the following parameters SET NEWNAME, SQL ALTER
DATABASE RENAME FILE and SWITCH DATAFILE similar to the following
RUN {
SET NEWNAME FOR DATAFILE 1 TO '/u01/PCBDB/dbs/system01.dbf';
SET NEWNAME FOR DATAFILE 2 TO '/u01/PCBDB/dbs/sysaux01.dbf';
SET NEWNAME FOR DATAFILE 3 TO '/u01/PCBDB/dbs/undotbs01.dbf';
SET NEWNAME FOR DATAFILE 4 TO '/u01/PCBDB/dbs/users01.dbf';
SET NEWNAME FOR DATAFILE 5 TO '/u01/PCBDB/dbs/example01.dbf';
SET NEWNAME FOR DATAFILE 6 TO '/u01/PCBDB/dbs/DEV_odi_user.dbf';
SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo02.log'' TO
''/u02/PCBDB/log/redo02.log''";
SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo01.log'' TO
''/u01/PCBDB/log/redo01.log''";
SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo03.log'' TO
''/u02/PCBDB/log/redo03.log''";
RESTORE DATABASE;
SWITCH DATAFILE ALL;
}
Finally execute the script as follows
RMAN> @restore
RMAN> RUN {
2> SET NEWNAME FOR DATAFILE 1 TO '/u01/PCBDB/dbs/system01.dbf';
3> SET NEWNAME FOR DATAFILE 2 TO '/u01/PCBDB/dbs/sysaux01.dbf';
4> SET NEWNAME FOR DATAFILE 3 TO '/u01/PCBDB/dbs/undotbs01.dbf';
5> SET NEWNAME FOR DATAFILE 4 TO '/u01/PCBDB/dbs/users01.dbf';
6> SET NEWNAME FOR DATAFILE 5 TO '/u01/PCBDB/dbs/example01.dbf';
7> SET NEWNAME FOR DATAFILE 6 TO '/u01/PCBDB/dbs/DEV_odi_user.dbf';
8> SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo02.log'' TO
''/u02/PCBDB/log/redo02.log''";
9> SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo01.log'' TO
''/u01/PCBDB/log/redo01.log''";
10> SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo03.log'' TO
''/u02/PCBDB/log/redo03.log''";
11> RESTORE DATABASE;
12> SWITCH DATAFILE ALL;
13> }
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
sql statement: ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo02.log''
TO ''/u02/PCBDB/log/redo02.log''
sql statement: ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo01.log''
TO ''/u01/PCBDB/log/redo01.log''
sql statement: ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo03.log''
TO ''/u02/PCBDB/log/redo03.log''
Starting restore at 02-FEB-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/PCBDB/dbs/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/PCBDB/dbs/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/PCBDB/dbs/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/PCBDB/dbs/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/PCBDB/dbs/example01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/PCBDB/dbs/DEV_odi_user.dbf
channel ORA_DISK_1: reading from backup piece
/u01/OraBkps/backupset/2015_02_02/o1_mf_nnndf_TAG20150202T184849_bdz73240_.bkp
RMAN-00571:
=======================================================
====
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
===============
RMAN-00571:
=======================================================
====
RMAN-03002: failure of recover command at 02/02/2015 22:52:07
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 3
and starting SCN of 1605785
After recovering your database instance, you can open it. You must specify RESETLOGS because
the new control file represents a different instantiation of the database
RMAN> ALTER DATABASE OPEN RESETLOGS;
database opened
References
Oracle Database Backup and Recovery User's Guide11g Release 2 (11.2)
Posted 3rd February by Sadock Obeth
0
Add a comment
2.
FEB
To check the current control file autobackups setting execute the following command
RMAN> SHOW CONTROLFILE AUTOBACKUP;
RMAN configuration parameters for database with db_unique_name PCBDB are:
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
To enable the control file autobackups feature execute the following command
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
RMAN> SHOW CONTROLFILE AUTOBACKUP;
RMAN configuration parameters for database with db_unique_name PCBDB are:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
The following example shows how RMAN perform autobackup of control file and SPFILE at the end
of any successful BACKUP command. The command backup only data file number 1 for simplicity.
Notice the location of autobackup
RMAN> backup datafile 1;
Starting backup at 02-FEB-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=35 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/PCBDB/system01.dbf
channel ORA_DISK_1: starting piece 1 at 02-FEB-15
channel ORA_DISK_1: finished piece 1 at 02-FEB-15
piece
handle=/u01/app/oracle/flash_recovery_area/PCBDB/backupset/2015_02_02/o1_mf_nnn
df_TAG20150202T135041_bdyon1nd_.bkp tag=TAG20150202T135041 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:36
Finished backup at 02-FEB-15
Starting Control File and SPFILE Autobackup at 02-FEB-15
piece handle=/u01/app/oracle/Backups/cf_c-132566208-20150202-05 comment=NONE
Finished Control File and SPFILE Autobackup at 02-FEB-15
piece
handle=/u01/app/oracle/flash_recovery_area/PCBDB/backupset/2015_02_02/o1_mf_nnn
df_TAG20150202T140537_bdypj1mr_.bkp tag=TAG20150202T140537 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
Finished backup at 02-FEB-15
Starting Control File and SPFILE Autobackup at 02-FEB-15
piece handle=/u02/Backups/pcbdbcf_c-132566208-20150202-06 comment=NONE
Finished Control File and SPFILE Autobackup at 02-FEB-15
The following example shows how RMAN perform autobackup of control file and SPFILE at the end
of any successful BACKUP command when SET CONTROLFILE AUTOBACKUP FORMAT command
is used within a RUN block
RMAN> run{
2> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
'/home/oracle/Backups/pcbdbcf_%F';
3> BACKUP DATAFILE 3;
4> }
executing command: SET CONTROLFILE AUTOBACKUP FORMAT
Starting backup at 02-FEB-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=29 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/u01/app/oracle/oradata/PCBDB/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 02-FEB-15
channel ORA_DISK_1: finished piece 1 at 02-FEB-15
piece
handle=/u01/app/oracle/flash_recovery_area/PCBDB/backupset/2015_02_02/o1_mf_nnn
df_TAG20150202T141356_bdypznr9_.bkp tag=TAG20150202T141356 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 02-FEB-15
Starting Control File and SPFILE Autobackup at 02-FEB-15
piece handle=/home/oracle/Backups/pcbdbcf_c-132566208-20150202-07
comment=NONE
Finished Control File and SPFILE Autobackup at 02-FEB-15
If the SPFILE is lost, you can restore it from the autobackup. However you must to set the DBID for
your database before you issue RESTORE SPFILE FROM AUTOBACKUP command otherwise it will
fail. The challenge with DBID (database identifier) is that, it is not something that would be available
until the database is at least mounted
The best practice it is recommended to record the DBID in a safe place or otherwise you can find it
on control file autobackup output file when substitution variable %F in the FORMAT clause is used as
demonstrated above. This variable format translates into c-IIIIIIIIII-YYYYMMDD-QQ, with the
placeholders
defined
as
follows:
IIIIIIIIII stands
for
the
DBID
YYYYMMDD is
a
time
stamp
of
the
day
the
backup
is
generated
QQ is the hex sequence that starts with 00 and has a maximum of FF
Example:
Starting Control File and SPFILE Autobackup at 02-FEB-15
piece handle=/home/oracle/Backups/pcbdbcf_c-132566208-2015020207 comment=NONE
Finished Control File and SPFILE Autobackup at 02-FEB-15
The following example simulate the loss of SPFILE on disk by renaming the file and attempt to
restart the database instance
[oracle@Lugao-odisrv dbs]$ mv spfilePCBDB.ora spfilePCBDB.ora.old
[oracle@Lugao-odisrv dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 2 14:31:07 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> startup force
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initPCBDB.ora'
SQL>
The following example shows how to use RMAN to restore the lost SPFILE from autobackup
[oracle@Lugao-odisrv ~]$ export ORACLE_SID=PCBDB
[oracle@Lugao-odisrv ~]$ rman target/
Recovery Manager: Release 11.2.0.1.0 - Production on Mon Feb 2 15:17:08 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> set dbid 132566208;
executing command: SET DBID
RMAN> startup force nomount;
159019008 bytes
1335192 bytes
75497576 bytes
79691776 bytes
2494464 bytes
849530880 bytes
1339824 bytes
532680272 bytes
310378496 bytes
5132288 bytes
The procedure to restore control file from autobackup is similar to restoring the SPFILE from
autobackup except that you should successful start the database instance to nomount state using
your SPFILE or PFILE.
The following example simulate the loss of all control files by deleting all control files on file system
and attempt to restart the database instance
SQL> select name from v$controlfile;
NAME
-------------------------------------------------------------------------------/u01/app/oracle/oradata/PCBDB/control01.ctl
/u01/app/oracle/flash_recovery_area/PCBDB/control02.ctl
[oracle@Lugao-odisrv ~]$ rm /u01/app/oracle/oradata/PCBDB/control01.ctl
[oracle@Lugao-odisrv ~]$ rm /u01/app/oracle/flash_recovery_area/PCBDB/control02.ctl
[oracle@Lugao-odisrv ~]$
SQL> startup force
ORACLE instance started.
Total System Global Area 849530880 bytes
Fixed Size
1339824 bytes
Variable Size
532680272 bytes
Database Buffers
310378496 bytes
Redo Buffers
5132288 bytes
ORA-00205: error in identifying control file, check alert log for more info
The following example shows how to use RMAN to restore the lost control files from autobackup
[oracle@Lugao-odisrv ~]$ export ORACLE_SID=PCBDB
[oracle@Lugao-odisrv ~]$ rman target/
Recovery Manager: Release 11.2.0.1.0 - Production on Mon Feb 2 16:35:21 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: PCBDB (not mounted)
RMAN> set dbid 132566208;
executing command: SET DBID
RMAN> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
'/home/oracle/Backups/pcbdbcf_%F';
executing command: SET CONTROLFILE AUTOBACKUP FORMAT
RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;
Starting restore at 02-FEB-15
Mount the database instance then perform recovery because you now have a backup control file that
contains information about an older version of the database
RMAN> ALTER DATABASE MOUNT;
database mounted
released channel: ORA_DISK_1
RMAN> RECOVER DATABASE;
Starting recover at 02-FEB-15
Starting implicit crosscheck backup at 02-FEB-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=21 device type=DISK
Crosschecked 12 objects
Finished implicit crosscheck backup at 02-FEB-15
Starting implicit crosscheck copy at 02-FEB-15
using channel ORA_DISK_1
Finished implicit crosscheck copy at 02-FEB-15
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name:
/u01/app/oracle/flash_recovery_area/PCBDB/archivelog/2015_02_02/o1_mf_1_8_bdywxmws_.
arc
using channel ORA_DISK_1
starting media recovery
After recovering the database, you can open it. You must specify RESETLOGS because the new
control file represents a different instantiation of the database
RMAN> ALTER DATABASE OPEN RESETLOGS;
database opened
Following RESETLOGS command you need immediate to full back up your database because
among other RESETLOGS option invalidate the old backups
References
Oracle Database Backup and Recovery User's Guide11g Release 2 (11.2)
Posted 2nd February by Sadock Obeth
0
Add a comment
3.
JAN
Steps to Go About
Network Setup
Network Setup
One of the essential part prior to the installation and configuration of RAC is network setup in all
nodes participating in RAC. Oracle 11gR2 RAC needs four network names and associated IP
Addresses configurations to work:
Public Host Name (for each node) is the primary name of the host as displayed by
command hostname and should be associated to any public network interface card IP Address
Private Host Name (for each node) associated to the private network interface card IP Address and
should not be accessible by any device not participating in RAC private network should be on
dedicated switch
Virtual Public Host Name (for each node) not assigned to any network interface card, is used to
reroute client requests sent to the node if the node is down
SCAN DNS name not assigned to any network interface card and is resolved by DNS to at least
three IP Addresses using round robin algorithm
SCAN DSN provide a single name for client to access Oracle database in a cluster independent of
which server in the cluster the database is active and should not appear in /etc/hosts file.
Public Host Name, Virtual Host Name and SCAN DNS name must be on the same subnet that is
accessible on public network by other devices (e.g. clients)
Private Host Name need not to be on DNS and should be entered in the /etc/hosts file
Sample IP Address Setup
Host
Public IP
Private IP
VIP
Lugao-srv01.lusam.tz
Lugao-srv02.lusam.tz
Interface --->
192.168.56.40
192.168.56.41
etho
172.16.9.11
172.16.9.12
eth1
192.168.56.50
192.168.56.51
SCAN: Lugaoracscan
IP1: 192.168.56.60
IP2: 192.168.56.61
IP3: 192.168.56.62
Regardless of using a DNS server it is recommended to add lines to the/etc/hosts file on each
node, for Public IP, VIP and Private IP addresses similar to the following:
#Public
192.168.56.40 Lugao-srv01.lusam.tz
Lugao-srv01
192.168.56.41 Lugao-srv02.lusam.tz
Lugao-srv02
#Private
172.16.9.11
172.16.9.11
Lgracnode1-priv.lusam.tz
Lgracnode2-priv.lusam.tz
Lgracnode1-priv
Lgracnode2-priv
#Virtual IP address
192.168.56.50 Lgracnode1-vip.lusam.tz
192.168.56.51 Lgracnode2-vip.lusam.tz
Lgracnode1-vip
Lgracnode2-vip
On all nodes change the name resolution search order in /etc/nsswitch.conf file by telling the
host to start looking the DNS server then methods follows. Search the following lines
#hosts:
db files nisplus nis dns
hosts:
files dns
Then change to:
#hosts:
db files nisplus nis dns
hosts:
dns files
After modifying the /etc/nsswitch.conf file, restart the nscd daemon on each node as follows
[root@Lugao-srv01 ~]# /sbin/service nscd restart
Stopping nscd:
[FAILED]
Starting nscd:
[ OK ]
[root@Lugao-srv01 ~]# /sbin/service nscd restart
Stopping nscd:
[ OK ]
Starting nscd:
[ OK ]
[root@Lugao-srv01 ~]#
Confirm SCAN configurations on DNS server is using round-robin name resolution algorithms by
using nslookupcommand. Run the nslookup command at least twice, the result should return a set
of 3 IPs in a different order in each run as follows
[root@Lugao-srv01 ~]# nslookup Lugaorac-scan
Server:
192.168.56.30
Address:
192.168.56.30#53
Name: Lugaorac-scan.lusam.tz
Address: 192.168.56.60
Name: Lugaorac-scan.lusam.tz
Address: 192.168.56.61
Name: Lugaorac-scan.lusam.tz
Address: 192.168.56.62
[root@Lugao-srv01 ~]#
[root@Lugao-srv01 ~]# nslookup Lugaorac-scan
Server:
192.168.56.30
Address:
192.168.56.30#53
Name: Lugaorac-scan.lusam.tz
Address: 192.168.56.61
Name: Lugaorac-scan.lusam.tz
Address: 192.168.56.62
Name: Lugaorac-scan.lusam.tz
Address: 192.168.56.60
Deconfigure NTP
Make sure NTP it is not configured so that Oracle Cluster Time Synchronization Service (ctssd)
can synchronize the times of the RAC nodes as follows
[root@Lugao-srv01 ~]# service ntpd status
ntpd is stopped
[root@Lugao-srv01 ~]# ls -lr /etc/ntp.conf
-rw-r--r-- 1 root root 1833 Oct 25 2011 /etc/ntp.conf
[root@Lugao-srv01 ~]#
[root@Lugao-srv01 ~]# mv /etc/ntp.conf /etc/ntp.conf.bkp
Repeat the procedure to attach the disks on the second virtual machine then power on all virtual
machines to start the process of portioning the attached disks
0
1
2
3
0
16
32
48
64
80
96
0
36700160 hda
104391 hda1
4192965 hda2
32395072 hda3
1048576 sda
1048576 sdb
1048576 sdc
5242880 sdd
5242880 sde
5242880 sdf
5242880 sdg
32374784 dm-0
From one node only run fdisk against each disk not partitioned to create a single whole-disk
partition and the sequence of answers is "n", "p", "1", "Return", "Return", "p" and "w" as follows
[root@Lugao-srv01 ~]# fdisk /dev/sda
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w (rite)
3
0 52428800 hda
3
1
104391 hda1
3
2 52323705 hda2
8
0 1048576 sda
8
1 1044193 sda1
8 16 1048576 sdb
8 17 1044193 sdb1
8 32 1048576 sdc
8 33 1044193 sdc1
8 48 5242880 sdd
8 49 5237158 sdd1
8 64 5242880 sde
8 65 5237158 sde1
8 80 5242880 sdf
8 81 5237158 sdf1
8 96 5242880 sdg
8 97 5237158 sdg1
253
0 46301184 dm-0
253
1 5996544 dm-1
[root@Lugao-srv02 ~]#
Software Requirements
On all nodes Use rpm command to install the following packages from Linux installation media
rpm -Uvh binutils-2.17.50.0.6*
rpm -Uvh compat-libstdc++-33*
rpm -Uvh elfutils-libelf-0*
rpm -Uvh elfutils-libelf-devel-*
rpm -Uvh gcc-4*
rpm -Uvh gcc-c++-4*
rpm -Uvh glibc-2*
rpm -Uvh glibc-common-2*
rpm -Uvh glibc-devel-2.*
rpm -Uvh glibc-headers*
rpm -Uvh ksh*
rpm -Uvh libaio-0*
rpm -Uvh libaio-devel-0*
rpm -Uvh libgcc-4*
rpm -Uvh libgomp*
rpm -Uvh libstdc++-4*
rpm -Uvh libstdc++-devel 4.*
rpm -Uvh make-3.*
rpm -Uvh numactl-devel-0.*
rpm -Uvh nutils-2.*
rpm -Uvh sysstat-7.*
rpm -Uvh unixODBC-2.*
rpm -Uvh unixODBC-devel-2.*
On all nodes use text editor of your choice, add the following lines in "/etc/sysctl.conf" file.
Include only the lines that have values greater than existing values in file
fs.suid_dumpable = 1
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default=4194304
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=1048586
On all nodes Open shell prompt then run /sbin/sysctl p command to change the current
kernel parameters
[root@avsrv ~]# /sbin/sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
fs.suid_dumpable = 1
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
[root@avsrv ~]#
On
all
nodes
use
editor
of
in "/etc/security/limits.conf" file
oracle
soft nproc 2047
oracle
hard nproc 16384
oracle
soft nofile 4096
oracle
hard nofile 65536
oracle
soft stack 10240
grid
soft nproc 2047
grid
hard nproc 16384
grid
soft nofile 4096
grid
hard nofile 65536
grid
soft stack 10240
your
choice
to
add
the
following
On all nodes Use editor of your choice add the following line "/etc/pam.d/login" file
session
required
/lib/security/pam_limits.so
lines
session
required
pam_limits.so
OS Group
oinstall
asmadmin
asmdba
Members
grid, oracle
grid
grid, oracle
Oracle Privilege
Oracle Group
SYSASM
SYSDBA for ASM
asmoper
grid
Database Administrator
Database Operator
dba
oper
oracle
oracle
SYSOPER
ASM
SYSDBA
SYSOPER
OSASM
OSDBA
ASM
OSOPER
ASM
OSDBA
OSOPER
for
for
for
Note: Ensure that the operating system groups and user IDs are identical (the same) on all Oracle
RAC nodes in the cluster otherwise installation checks will fail. As root user run as follows on all
nodes
[root@Lugao-srv01 ~]# groupadd -g 512 oinstall
[root@Lugao-srv01 ~]# groupadd -g 513 dba
[root@Lugao-srv01 ~]# groupadd -g 514 oper
[root@Lugao-srv01 ~]# groupadd -g 515 asmadmin
[root@Lugao-srv01 ~]# groupadd -g 516 asmdba
[root@Lugao-srv01 ~]# groupadd -g 517 asmoper
[root@Lugao-srv01
[root@Lugao-srv01
[root@Lugao-srv01
[root@Lugao-srv01
On both Oracle RAC nodes edit /home/oracle/.bash_profile file by adding the following lines
(When
setting
the
Oracle
environment
variables
for
each
node
replace ORACLE_HOSTNAME and ORACLE_SID variables with appropriate unique values)
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=lugao-srv01; export ORACLE_HOSTNAME
ORACLE_UNQNAME=PCBRAC; export ORACLE_UNQNAME
ORACLE_SID=PCBRAC1; export ORACLE_SID
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
Oracle provides ASMLib 2.0 which is a support library for the Automatic Storage Management (ASM)
feature of the Oracle Database at OTN page. ASM is highly recommended as the shared file system
and volume manager for Oracle Clusterware files (OCR and voting disk), Oracle Database files
(data, online redo logs, control files, archived redo logs), and the Fast Recovery Area
NOTE: The ASMLib kernel driver MUST match the kernel version number, the kernel version number
can be identified by running the "uname -r" command. Also, be sure to download the set of RPMs
which pertain to your platform architecture
[root@Lugao-srv01 ~]# uname -ri
2.6.18-308.el5 x86_64
[root@Lugao-srv01 ~]#
In our case, install the following packages on all RAC nodes as follows as root user
rpm -Uvh oracleasm-support-2.1.8-1.el5.x86_64.rpm
rpm -Uvh oracleasm-2.6.18-308.el5-debuginfo-2.0.5-1.el5.x86_64.rpm
rpm -Uvh oracleasm-2.6.18-308.el5-2.0.5-1.el5.x86_64.rpm
rpm -Uvh oracleasmlib-2.0.4-1.el5.x86_64.rpm
Configure ASMLib by running the following as the root user on all RAC nodes
[root@Lugao-srv01 ASMLib]# /etc/init.d/oracleasm configure -i
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: grid
Default group to own the driver interface []: asmadmin
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:
[ OK ]
Scanning the system for Oracle ASMLib disks:
[ OK ]
[root@Lugao-srv01 ASMLib]#
Use the oracleasm createdisk command to create the ASM disk label on one node only
[root@Lugao-srv01 ASMLib]# oracleasm createdisk OCR_VOTE01 /dev/sda1
Writing disk header: done
Instantiating disk: done
[root@Lugao-srv01 ASMLib]# oracleasm createdisk OCR_VOTE02 /dev/sdb1
Writing disk header: done
Instantiating disk: done
[root@Lugao-srv01 ASMLib]# oracleasm createdisk OCR_VOTE03 /dev/sdc1
Writing disk header: done
Instantiating disk: done
[root@Lugao-srv01 ASMLib]# oracleasm createdisk ASM_DATA01 /dev/sdd1
Writing disk header: done
Instantiating disk: done
[root@Lugao-srv01 ASMLib]# oracleasm createdisk ASM_DATA02 /dev/sde1
Writing disk header: done
Instantiating disk: done
[root@Lugao-srv01 ASMLib]# oracleasm createdisk ASM_FRA01 /dev/sdf1
Writing disk header: done
Instantiating disk: done
[root@Lugao-srv01 ASMLib]# oracleasm createdisk ASM_FRA02 /dev/sdg1
Writing disk header: done
Instantiating disk: done
[root@Lugao-srv01 ASMLib]#
Check the disks are mounted in the oracleasm file system
[root@Lugao-srv01 ASMLib]# ls -l /dev/oracleasm/disks
total 0
brw-rw---- 1 grid asmadmin 8, 49 Dec 20 16:18 ASM_DATA01
brw-rw---- 1 grid asmadmin 8, 65 Dec 20 16:19 ASM_DATA02
brw-rw---- 1 grid asmadmin 8, 81 Dec 20 16:25 ASM_FRA01
brw-rw---- 1 grid asmadmin 8, 97 Dec 20 16:20 ASM_FRA02
brw-rw---- 1 grid asmadmin 8, 1 Dec 20 16:17 OCR_VOTE01
brw-rw---- 1 grid asmadmin 8, 17 Dec 20 16:17 OCR_VOTE02
brw-rw---- 1 grid asmadmin 8, 33 Dec 20 16:17 OCR_VOTE03
[root@Lugao-srv01 ASMLib]#
On all the other nodes in the cluster, use the scandisks command as the root user to pick-up the
newly created ASM disks. You do not need to create the ASM disks on each node, only on one node
in the cluster
[root@Lugao-srv02 ASMLib]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
Instantiating disk "OCR_VOTE01"
Instantiating disk "OCR_VOTE02"
Instantiating disk "OCR_VOTE03"
Instantiating disk "ASM_DATA01"
Instantiating disk "ASM_DATA02"
Instantiating disk "ASM_FRA01"
Instantiating disk "ASM_FRA02"
[root@Lugao-srv02 ASMLib]#
[root@Lugao-srv02 ASMLib]# ls -l /dev/oracleasm/disks
total 0
brw-rw---- 1 grid asmadmin 8, 49 Dec 20 16:26 ASM_DATA01
brw-rw---- 1 grid asmadmin 8, 65 Dec 20 16:26 ASM_DATA02
brw-rw---- 1 grid asmadmin 8, 81 Dec 20 16:26 ASM_FRA01
brw-rw---- 1 grid asmadmin 8, 97 Dec 20 16:26 ASM_FRA02
brw-rw---- 1 grid asmadmin 8, 1 Dec 20 16:26 OCR_VOTE01
brw-rw---- 1 grid asmadmin 8, 17 Dec 20 16:26 OCR_VOTE02
brw-rw---- 1 grid asmadmin 8, 33 Dec 20 16:26 OCR_VOTE03
[root@Lugao-srv02 ASMLib]#
Node 1
[grid@Lugao-srv01 ~]$ su - root
Password:
[root@Lugao-srv01 ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@Lugao-srv01 ~]#
Node 2:
[grid@Lugao-srv01 ~]$ su - root
Password:
[root@Lugao-srv02 ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@Lugao-srv02 ~]#
Node 1:
[root@Lugao-srv01 ~]# /u01/app/11.2.0/grid/root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/11.2.0/grid
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
CRS-2676:
CRS-2672:
CRS-2676:
CRS-2672:
CRS-2676:
lugao-srv01
2014/12/23 14:59:25
/u01/app/11.2.0/grid/cdata/lugaosrv01/backup_20141223_145925.olr
Preparing packages for installation...
cvuqdisk-1.0.7-1
Configure Oracle Grid Infrastructure for a Cluster ... succeeded
Updating inventory properties for clusterware
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 4094 MB
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /u01/app/oraInventory
'UpdateNodeList' was successful.
[root@Lugao-srv01 ~]#
Passed
Node 2:
[root@Lugao-srv02 ~]# /u01/app/11.2.0/grid/root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/11.2.0/grid
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
2014-12-23 15:01:01: Parsing the host name
2014-12-23 15:01:01: Checking for super user privileges
2014-12-23 15:01:01: User has super user privileges
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
/home/grid/.bash_profile: line 14: racle: command not found
LOCAL ADD MODE
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Adding daemon to inittab
CRS-4123: Oracle High Availability Services has been started.
ohasd is starting
CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon
on node lugao-srv01, number 1, and is terminating
An active cluster was found during exclusive startup, restarting to join the cluster
CRS-2672: Attempting to start 'ora.mdnsd' on 'lugao-srv02'
CRS-2676:
CRS-2672:
CRS-2676:
CRS-2672:
CRS-2676:
CRS-2672:
CRS-2676:
CRS-2672:
CRS-2672:
CRS-2676:
CRS-2676:
CRS-2672:
CRS-2676:
CRS-2672:
CRS-2676:
CRS-2672:
CRS-2676:
CRS-2672:
CRS-2676:
CRS-2672:
CRS-2676:
lugao-srv02
2014/12/23 15:06:22
/u01/app/11.2.0/grid/cdata/lugaosrv02/backup_20141223_150622.olr
Preparing packages for installation...
cvuqdisk-1.0.7-1
Configure Oracle Grid Infrastructure for a Cluster ... succeeded
Updating inventory properties for clusterware
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 5855 MB
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /u01/app/oraInventory
'UpdateNodeList' was successful.
[root@Lugao-srv02 ~]#
Passed
Node 1:
[oracle@Lugao-srv01 ~]$ su - root
Password:
[root@Lugao-srv01 ~]#
[root@Lugao-srv01 ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
[root@Lugao-srv01 ~]#
Node 2:
[oracle@Lugao-srv01 ~]$ su - root
Password:
[root@Lugao-srv02 app]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
VERIFICATION
Finally the installation of Oracle Database Real Application Cluster on two nodes using virtual disk
as shared storage is over.
Use several commands to verify working of RAC on all cluster nodes as follows
[oracle@Lugao-srv01 bin]$ srvctl status database -d PCBRAC
Instance PCBRAC1 is running on node lugao-srv01
Instance PCBRAC2 is running on node lugao-srv02
[oracle@Lugao-srv01 bin]$
[grid@Lugao-srv02 ~]$ srvctl status database -d PCBRAC
Instance PCBRAC1 is running on node lugao-srv01
Instance PCBRAC2 is running on node lugao-srv02
[grid@Lugao-srv02 ~]$
Now, switch off the node shown on the above query (e.g. Lugao-srv02) then from any client use
Oracle Easy connect method that involve SCAN Name to connect to the RAC database. Verify that
you can connect to another active instance
C:\Users\Administrator>
C:\Users\Administrator>sqlplus /nolog
Add a comment
4.
JAN
This capability can be utilized as one way to move Oracle Database datafile to other location. In fact
this capability can be used also as a backup strategy for controlfile. It easy to recover from loss of all
multiplexed binary versions of the control file due to a catastrophic failure from a trace file than most
of the other methods. Thus Oracle recommend to backup to trace (create text file version of
controlfile) controlfile at least each time the structure of database is changed e.g. adding or deleting
datafiles on the tablespace
Steps to Go About
Determine Existing Locations of Datafiles
Create Editable Text Version of Controfile
Shutdown the Instance
Move the Datafiles to New Locations
Edit the Text Controlfile
Create New Binary Controlfiles From Text File Version
Verification
Use SQL*Plus to query V$DATAFILE data dictionary view to determine the location of all database
datafiles in the server as follows
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------/prod1/app/oracle/oradata/PCBDB/system01.dbf
/prod1/app/oracle/oradata/PCBDB/sysaux01.dbf
/prod1/app/oracle/oradata/PCBDB/undotbs01.dbf
/prod1/app/oracle/oradata/PCBDB/users01.dbf
/prod1/app/oracle/oradata/PCBDB/example01.dbf
/prod1/app/oracle/oradata/PCBDB/DEV_odi_user.dbf
6 rows selected.
[oracle@Lugao-srv01~]$ mv /prod1/app/oracle/oradata/PCBDB/example01.dbf
/prod2/app/oracle/oradata/PCBDB/example01.dbf
Note: Ignore any error thrown that indicates the Oracle was attempting to recover the instance as no
any recovery was required, the database was brought down clean
Verification
View comments
5.
DEC
12
It may happen in Oracle data guard environment that the standby database is behind the primary
database and some archivelogs to recover the standby database have been deleted at primary
server before being shipped to the standby server. In this case the alert log will have entries with
complain about Oracle failed to resolve the gap sequence automatically similar to the following
Thu Dec 11 15:19:26 2014
FAL[client]: Failed to request gap sequence
GAP - thread 1 sequence 11498-11519
DBID 1691272038 branch 632153977
FAL[client]: All defined FAL servers have been attempted.
------------------------------------------------------------Check that the CONTROL_FILE_RECORD_KEEP_TIME initialization
parameter is defined to a value that is sufficiently large
enough to maintain adequate log switch information to resolve
archivelog gaps.
------------------------------------------------------------Here the archivelogs from 11498-11519 not found at primary database. In this case you have many
options to solve the problem, one is to recreate the standby database that may require movement of
the whole database to standby server if you have time to do so. However the least cost option is to
take the missing gaps only from primary database though incremental backup
[Standby Database] Query the standby database to get the current SCN, it will be used as
demarcation point to start incremental backup at primary database
SQL> select to_char(current_scn) from v$database;
TO_CHAR(CURRENT_SCN)
---------------------------------------5993380642292
SQL>
[Primary Database] Create RMAN incremental backup at primary database. Use the SCN from
above step to mark demarcation point to start backup
FDIDB-/home/oracle> export ORACLE_SID=FDIDB
FDIDB-/home/oracle> rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Fri Dec 12 12:41:45 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: FDIDB (DBID=1691272038)
RMAN> BACKUP DEVICE TYPE DISK INCREMENTAL FROM
SCN 5993380642292 DATABASE FORMAT '/prod2/backup/fdidb/incr_for_stdby_%U';
Starting backup at 12-DEC-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=43 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=53 device type=DISK
backup will be obsolete on date 19-DEC-14
archived logs will not be kept or backed up
RMAN-06755: WARNING: datafile 10: incremental-start SCN is too recent; using
checkpoint SCN 5979602355940 instead
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/prod1/fdidb/dbs/users01.dbf
input datafile file number=00011 name=/prod1/fdidb/dbs/users03.dbf
input datafile file number=00003 name=/prod1/fdidb/dbs/sysaux01.dbf
input datafile file number=00005 name=/prod2/fdidb/dbs/cwmlite01.dbf
input datafile file number=00006 name=/prod2/fdidb/dbs/drsys01.dbf
input datafile file number=00008 name=/prod2/fdidb/dbs/tools01.dbf
input datafile file number=00013 name=/prod1/fdidb/dbs/sysaux02.dbf
channel ORA_DISK_1: starting piece 1 at 12-DEC-14
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00010 name=/prod1/fdidb/dbs/users02.dbf
skipping datafile 00010 because it has not changed
input datafile file number=00001 name=/prod1/fdidb/dbs/system01.dbf
input datafile file number=00014 name=/prod1/fdidb/dbs/system03.dbf
input datafile file number=00012 name=/prod1/fdidb/dbs/system02.dbf
input datafile file number=00002 name=/prod1/fdidb/dbs/undotbs01.dbf
input datafile file number=00009 name=/prod2/fdidb/dbs/xdb01.dbf
input datafile file number=00007 name=/prod2/fdidb/dbs/indx01.dbf
channel ORA_DISK_2: starting piece 1 at 12-DEC-14
channel ORA_DISK_2: finished piece 1 at 12-DEC-14
piece handle=/prod2/backup/fdidb/incr_for_stdby_3ippvroh_1_1
tag=TAG20141212T124352 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:01:15
channel ORA_DISK_1: finished piece 1 at 12-DEC-14
piece handle=/prod2/backup/fdidb/incr_for_stdby_3hppvrof_1_1
tag=TAG20141212T124352 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:37
using channel ORA_DISK_1
using channel ORA_DISK_2
backup will be obsolete on date 19-DEC-14
archived logs will not be kept or backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 12-DEC-14
channel ORA_DISK_1: finished piece 1 at 12-DEC-14
piece handle=/prod2/backup/fdidb/incr_for_stdby_3jppvrri_1_1
tag=TAG20141212T124352 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 12-DEC-14
ls -li
oinstall 10731520 Dec 12 12:51 fdidb_standby.ctl
oinstall 250331136 Dec 12 12:45 incr_for_stdby_3hppvrof_1_1
oinstall 94765056 Dec 12 12:45 incr_for_stdby_3ippvroh_1_1
incr_for_stdby_3ippvroh_1_1
Max throughput: 10.0MB/s
incr_for_stdby_3jppvrri_1_1
Max throughput: 10.0MB/s
FDIDB-/prod2/backup/fdidb>
[Standby Database] However before shutting down the standby database, query the data dictionary
to get the locations of all controlfiles
SQL> select name from v$controlfile;
NAME
----------------------------------------/prod1/fdidb/log/control01.ctl
/prod2/fdidb/log/control02.ctl
/prod3/fdidb/log/control03.ctl
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Verification
At this point the gap sequence has been resolved and the standby database is at par with primary
database. You may query the maximum sequence number applied at primary and standby database
to justify as follows
[Primary Database]
SQL> select max(sequence#)
2 from v$archived_log
3 where applied='YES';
MAX(SEQUENCE#)
-------------11576
[Standby Database]
SQL> select max(sequence#)
2 from v$archived_log
3 where applied='YES';
MAX(SEQUENCE#)
-------------11576
No more complain that Failed to request gap sequence in alert file. In fact the next atchivelog
here 11577 is on the way in transit from primary database
alter database recover managed standby database disconnect from session
Attempt to start background Managed Standby Recovery process (FDIDB)
Fri Dec 12 11:44:02 2014
MRP0 started with pid=28, OS id=8011
MRP0: Background Managed Standby Recovery process started (FDIDB)
started logmerger process
Fri Dec 12 11:44:07 2014
Managed Standby Recovery not using Real Time Apply
Parallel Media Recovery started with 2 slaves
Fri Dec 12 11:44:08 2014
Warning: recovery process PR01 cannot use async I/O
Fri Dec 12 11:44:08 2014
Warning: recovery process PR02 cannot use async I/O
Warning: Datafile 10 (/prod1/fdidb/dbs/users02.dbf) is offline during full database
recovery and will not be recovered
Waiting for all non-current ORLs to be archived...
All non-current ORLs have been archived.
Media Recovery Log /prod2/fdidb/arch/1_11576_632153977.arc
Media Recovery Waiting for thread 1 sequence 11577 (in transit)
Completed: alter database recover managed standby database disconnect from session
Obtain the latest RCU from Oracle, unzip then run the file RCU_HOME/bin/rcu to starts
the wizards
Posted 12th December 2014 by Sadock Obeth
0
Add a comment
6.
OCT
27
.Therefore, if you are not planning to use Java EE components, you dont need any application
server prior to ODI installation
ODI keeps configurations information, metadata, objects and execution logs in database schema.
Thus database needs to be created prior to run RCU to create the repositories. The database can be
Oracle, Microsoft SQL Server or IBM DB2. Both Master and Work Repositories can be in a single
schema
This installation steps use Oracle Database 11gR2 installed on Red Hat Enterprise Linux 5.9
(32bits). The database for repositories and ODI software is on same server, however is not
mandatory
Creation of repositories prior to install ODI is option. You can choose to create and configure later
using ODI studio. However if you want all in hands after installation of ODI complete, use Repository
Creation Utility (RCU) to create the repository.
Obtain the latest RCU from Oracle, unzip then run the file RCU_HOME/bin/rcu to starts the wizards
Select the Database Type then enter connection information to the database you want to keep
the repositories as shown above
Click OK
On Select Components screen, enter the prefix on Create a new Prefix text box,
expand Oracle Data Integrator then select Master and Work Repository. Click Next
Click OK
Select Use same password for all schema, enter the password, confirm the password then
click Next
On Custom variable enter the values for Master and Work Repository as show above then
click Next
Click Next
Accept by clicking OK
inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm
inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm
Extraction of RPM Done.
Done.
[root@Lugao-odisrv ~]# ls
anaconda-ks.cfg
scsrun.log
Desktop
sun-javadb-client-10.6.2-1.1.i386.rpm
install.log
sun-javadb-common-10.6.2-1.1.i386.rpm
install.log.syslog
sun-javadb-core-10.6.2-1.1.i386.rpm
jdk-6u45-linux-i586.rpm
sun-javadb-demo-10.6.2-1.1.i386.rpm
jdk-6u45-linux-i586-rpm.bin sun-javadb-docs-10.6.2-1.1.i386.rpm
jdk-7-linux-i586.rpm
sun-javadb-javadoc-10.6.2-1.1.i386.rpm
jdk-8u25-linux-i586.rpm
[root@Lugao-odisrv ~]#
[root@Lugao-odisrv ~]# rpm -ivh jdk-6u45-linux-i586.rpm
Preparing...
##########################################
# [100%]
1:jdk
###########################################
[100%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
plugin.jar...
javaws.jar...
deploy.jar...
[root@Lugao-odisrv ~]#
Finally you are ready to run ODI software installer. Go to the directory where you unpacked the
archive file and switch to the Disk1 directory then run Installer file. You must supply the full path of
JDK home installed on your system when prompted as follows
[oracle@Lugao-odisrv Disk1]$ ./runInstaller
Starting Oracle Universal Installer...
Checking if CPU speed is above 300 MHz. Actual 3247 MHz Passed
Checking Temp space: must be greater than 300 MB. Actual 4558 MB Passed
Checking swap space: must be greater than 512 MB. Actual 5122 MB Passed
Checking monitor: must be configured to display at least 256 colors. Actual
16777216 Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-10-24_07-27-22PM.
Please wait ...
Please specify JDK location ( Ex. /home/jdk ),
<location>/bin/java should
exist :/usr/java/jdk1.6.0_45
[oracle@Lugao-odisrv Disk1]$ Log: /u01/app/oraInventory/logs/install2014-10-24_07-2722PM.log
On Select
Installation
Type select
any
combination
option
from Developer
Installation and Standalone Installationdepending on components you want to install as
shown above (Do not select any option from Java EE Installation this require application
server installation exist on server) then click Next
Enter Oracle Directory for ODI. The wizard will create for you if the directory does not exist
Enter database connect string to the repositories created. Enter the username and password of
repository schema then clickNext
Enter ODI password as supplied during creation of repository using RCU on custom variable
screen then click Next
Enter the Agent Name and Agent Port then click Next
You may unselect I Wish to receive security updates via My Oracle Support if you dont
have MOS credentials then clickNext
Verification
To verify installation of ODI start ODI studio from ODI_HOME/oracledi/client as follow
[oracle@Lugao-odisrv ~]$ cd /u01/app/oracle/Middleware/ODI_11G/oracledi/client
[oracle@Lugao-odisrv client]$ ls
ant
jdev log
odi64.exe rdbms
ide
jlib modules odi.exe sleepycat
integration jviews odi
odi.sh
timingframework
[oracle@Lugao-odisrv client]$
[oracle@Lugao-odisrv client]$ ./odi.sh
Oracle Data Integrator 11g
Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
ODI studio
References
Oracle Fusion Middleware Installation Guide for Oracle Data Integrator 11g Release 1 (11.1.1.7.0)
Add a comment
7.
OCT
16
Primary database needs initialization parameters that control redo transport service while the
database is in the primary role. It is recommended also the primary database to have parameters
that control the receipt of redo when the role is reversed to standby
[Primary Database] Check the value assigned to db_unique_name parameter and then use that
value
and
unique
name
of
standby
databases
to
TYPE
VALUE
alter
string
system
set
LGPROD
log_archive_config='DG_CONFIG=(LGPROD,LGPROD_STBY)'
scope=both;
System altered.
[Primary Database] Use log_archive_dest_n parameter to set suitable local and remote archive
log destinations. This case is using Fast Recovery Area for local location.
SQL> alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST' scope=both;
System altered.
SQL> show parameter db_recovery_file_dest;
NAME
TYPE
VALUE
string
/u01/app/oracle/flash_recovery_area
[Primary Database] The fal_server and fal_client parameters are purely option but they
recommended to make sure the primary is ready to switch roles to become a standby
SQL> alter system set FAL_SERVER=PCB_STBY scope=both;
System altered.
SQL> alter system set FAL_CLIENT=PCB scope=both;
System altered.
[Primary Database]Some of the initialization parameters modified above are static, so the database
needs to be restarted before for them to take effect
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 613797888 bytes
Fixed Size
2215824 bytes
Variable Size
406847600 bytes
Database Buffers
Redo Buffers
201326592 bytes
3407872 bytes
Database mounted.
Database opened.
Edit and amend some parameters in the file to make it relevant for standby database similar to the
following
*.audit_file_dest='/u01/app/oracle/admin/LGPROD/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/LGPROD_STBY/control01.ctl','/u01/app/oracle/oradat
a/LGPROD_STBY/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='LGPROD'
*.db_unique_name='LGPROD_STBY'
*.db_file_name_convert='/u01/app/oracle/oradata/LGPROD/','/u01/app/oracle/oradata/LGPRO
D_STBY/'
*.log_file_name_convert='/u01/app/oracle/oradata/LGPROD/',
'/u01/app/oracle/oradata/LGPROD_STBY/'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/u01/app/oracle'
*.fal_client='LGPROD_STBY'
*.fal_server='LGPROD'
*.log_archive_config='DG_CONFIG= (LGPROD, LGPROD_STBY)'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'
*.log_archive_dest_2='SERVICE=LGPROD ASYNC VALID_FOR= (ONLINE_LOGFILE,
PRIMARY_ROLE) COMPRESSION=ENABLE DB_UNIQUE_NAME=LGPROD'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='%t_%s_%r.arc'
*.remote_login_passwordfile='EXCLUSIVE'
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'
Database]
on
standby
server as follow. The first descriptor is connection to the primary database while the second
descriptor is connection to the auxiliary instance (standby database)
LGPROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.120.130)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = LGPROD)
)
)
LGPROD_STBY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.120.131)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = LGPROD_STBY)
)
)
[Standby
Database]
on
standby
server. The auxiliary instance location must to be hard-coded in this file otherwise RMAN Duplicate
command will fail
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = LGPROD_STBY)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = LGPROD)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Lugao-srv02)(PORT = 1521))
)
ADR_BASE_LISTENER = /u01/app/oracle
LGPROD_STBY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.120.131)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = LGPROD_STBY)
)
)
oracle@192.168.120.131's password:
o1_mf_annnn_TAG20140926T152840_b2bpzr9d_.bkp
36KB 35.5KB/s 00:00
o1_mf_annnn_TAG20140926T152716_b2bpx4kx_.bkp
14MB 14.3MB/s 00:01
o1_mf_nnndf_TAG20140926T152719_b2bpx7wn_.bkp
1015MB 9.5MB/s 01:47
o1_mf_ncnnf_TAG20140926T152719_b2bpzp9j_.bkp
9568KB 9.3MB/s 00:01
[oracle@Lugao-srv01 ~]$
100%
100%
100%
100%
[Standby Database] Make SPFILE for auxiliary instance, shutdown the instance then start the
instance in nomount state with a new parameter file
SQL> create spfile from pfile='/home/oracle/pfilelgprod.ora';
File created.
SQL>
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 146472960 bytes
Fixed Size
1335080 bytes
Variable Size
92274904 bytes
Database Buffers
50331648 bytes
Redo Buffers
2531328 bytes
}
executing Memory Script
executing command: SET until clause
Starting recover at 26-SEP-14
using channel ORA_AUX_DISK_1
starting media recovery
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=11
channel ORA_AUX_DISK_1: reading from backup piece
/u01/app/oracle/flash_recovery_area/LGPROD/backupset/2014_09_26/o1_mf_annnn_TAG2014
0926T152840_b2bpzr9d_.bkp
channel ORA_AUX_DISK_1: piece
handle=/u01/app/oracle/flash_recovery_area/LGPROD/backupset/2014_09_26/o1_mf_annnn_
TAG20140926T152840_b2bpzr9d_.bkp tag=TAG20140926T152840
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archived log file
name=/u01/app/oracle/flash_recovery_area/LGPROD_STBY/archivelog/2014_09_26/o1_mf_1_
11_b2bsx5y8_.arc thread=1 sequence=11
channel clone_default: deleting archived log(s)
archived log file
name=/u01/app/oracle/flash_recovery_area/LGPROD_STBY/archivelog/2014_09_26/o1_mf_1_
11_b2bsx5y8_.arc RECID=1 STAMP=859306709
media recovery complete, elapsed time: 00:00:02
Finished recover at 26-SEP-14
Finished Duplicate Db at 26-SEP-14
Database altered.
SQL> alter database recover managed standby database disconnect;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL>
Verification
Now that the standby database is up and running you need to make sure redo is getting transferred
properly to the standby.
[Primary Database] Check the status of online redo log
SQL> select group#, sequence#, status from v$log;
GROUP# SEQUENCE# STATUS
---------- ---------- ---------------1
19 CURRENT
2
17 INACTIVE
3
18 INACTIVE
[Standby Database] Check the status of online redo log. Inactive log (sequence# 17 and 18) from
primary database already applied to the standby database
SQL> select group#, sequence#, status from v$log;
GROUP# SEQUENCE# STATUS
---------- ---------- ---------------1
19 CLEARING_CURRENT
3
18 CLEARING
2
17 CLEARING
[Standby Database] Verify automatic apply process (Managed Recovery Process, MRP) on standby
database is started
SQL> select process, status, sequence# from v$managed_standby;
PROCESS STATUS
SEQUENCE#
--------- ------------ ---------ARCH
CONNECTED
0
ARCH
CONNECTED
0
ARCH
CONNECTED
0
ARCH
CONNECTED
0
RFS
IDLE
0
RFS
IDLE
19
MRP0
WAIT_FOR_LOG
19
7 rows selected.
Add a comment
8.
JUL
22
SQL to Split Full Name into First Name, Middle Names, and Last
Name in Oracle
Today morning my colleague ask me the query to split the full name stored in a single filed in the
table into First Name, Middle Names and Last name in Oracle database. After a lot of brainstorming,
using SUBSTR and INSTR functions I came out with just simple query as follows
SQL to Create Sample Table
SQL> create table testnames (fullname varchar2(30));
Table created.
SQL>
SQL to Insert Sample Data
SQL> insert into testnames values ('Sadock Obeth');
1 row created.
SQL> insert into testnames values ('Emmanuel Obeth Nyaluke');
1 row created.
SQL> insert into testnames values ('William Obeth Salon Nyaluke');
1 row created.
SQL>
Sample Data in Table
SQL> select * from testnames;
FULLNAME
-----------------------------Sadock Obeth
Emmanuel Obeth Nyaluke
William Obeth Salon Nyaluke
SQL>
Query to Split Names
SQL> select
2 SUBSTR(fullname, 1, INSTR(fullname, ' ', 1, 1)-1) fname,
3 SUBSTR(fullname,
INSTR(fullname, ' ', 1)+1,
INSTR(fullname, ' ', -1,1) - INSTR(fullname, ' ', 1,1)-1) Mnames,
4 SUBSTR(fullname, INSTR(fullname, ' ', -1)+1) lname
5 from testnames;
FNAME
MNAMES
LNAME
---------- ------------- ---------Sadock
Obeth
Emmanuel Obeth
Nyaluke
William Obeth Salon Nyaluke
SQL>
Posted 22nd July 2014 by Sadock Obeth
2
View comments
9.
MAY
A snapshot standby database provides disaster recovery and data protection benefits that are similar
to those of a physical standby database, however it should be used in case you need to benefit from
temporary read-write standby database
When a physical standby database is converted into a snapshot standby database an implicit
guaranteed restore point is created. This guaranteed restore point is used to flashback a snapshot
standby to its original state when it is converted back into a physical standby database.
The following example shows the physical standby database is running in ready only which does not
permit update to the data
SQL> select status,instance_name,database_role,open_mode
2 from v$database,v$instance;
STATUS
INSTANCE_NAME DATABASE_ROLE OPEN_MODE
------------ ---------------- ---------------- -------------------OPEN
PCB_STBY
PHYSICAL STANDBY READ ONLY WITH APPLY
SQL> update hr.departments set department_name= 'Admin'
2 where department_id=10;
update hr.departments set department_name= 'Admin'
*
ERROR at line 1:
ORA-16000: database open for read-only access
How to Setup?
To throw away all local changes made to the database when it is switched back to physical standby
state snapshot standby database use flashback database, however the standby database does not
need to have flashback database explicitly enabled.
Step 1: Shutdown the database then bring back to mount state
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup mount
ORACLE instance started.
Total System Global Area 613797888 bytes
Fixed Size
2215824 bytes
Variable Size
369098864 bytes
Database Buffers
239075328 bytes
Redo Buffers
3407872 bytes
Database mounted.
SQL>
SQL> select flashback_on FROM v$database;
FLASHBACK_ON
-----------------NO
As stated once the snapshot is bought back to physical all changes after guarantee restore point
created are lost and the restore point is dropped, redo apply can be started and all redo received by
the snapshot standby database will be applied
Step 1: Shutdown the database then bring back to mount state
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>
SQL> startup mount
ORACLE instance started.
DEPARTMENT_ID DEPARTMENT_NAME
MANAGER_ID LOCATION_ID
------------- ------------------------------ ---------- ----------10 Administration
200
1700
Note from Oracle doc: Flashback Database is used to convert a snapshot standby database back
into a physical standby database. Any operation that cannot be reversed using Flashback Database
technology will prevent a snapshot standby from being converted back to a physical standby
Thanks, Sadock
References
Oracle Database Document Library: Oracle Data Guard Concepts and Administration 11g R2
Oracle Base: Data Guard Physical Standby Setup in Oracle Database 11g Release 2
Posted 8th May 2014 by Sadock Obeth
0
Add a comment
10.
MAY
However, it can be opened in ready only mode to allow queries against users data. This help to
offload some of the operations against production database to the standby database such as
backups and reporting
When the database is open in ready only mode, archive log shipping from primary database
continue but Managed Recover Process (MRP) stops applying them on the standby database. This
makes the standby database to becomes increasingly out of date until MRP is resumed
PROCESS STATUS
SEQUENCE#
--------- ------------ ---------ARCH
CONNECTED
0
ARCH
CONNECTED
0
ARCH
CONNECTED
0
ARCH
CLOSING
81
RFS
IDLE
82
RFS
IDLE
0
MRP0
APPLYING_LOG
82
7 rows selected.
SQL> select status,instance_name,database_role,open_mode
2 from v$database, v$instance;
STATUS
INSTANCE_NAME DATABASE_ROLE OPEN_MODE
------------ ---------------- ---------------- -------------------OPEN
PCB_STBY
PHYSICAL STANDBY READ ONLY WITH APPLY
SQL> select * from hr.departments
2 where department_id=10;
DEPARTMENT_ID DEPARTMENT_NAME
MANAGER_ID LOCATION_ID
------------- ------------------------------ ---------- ----------10 Administration
200
1700
Here, you can see that the MRP is active and is applying log sequence 82 and also the physical
standby database is opened in READ-ONLY mode which allow users to use the standby database
for querying data
Note the following:
Mounted Standby database cannot be opened if MRP is active on background. See example below
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup nomount
ORACLE instance started.
Total System Global Area 613797888 bytes
Fixed Size
2215824 bytes
Variable Size
369098864 bytes
Database Buffers
239075328 bytes
Redo Buffers
3407872 bytes
SQL>
SQL> alter database mount standby database;
Database altered.
SQL> select process,status,sequence#
2> from v$managed_standby;
PROCESS STATUS
SEQUENCE#
--------- ------------ ---------ARCH
CONNECTED
0
ARCH
CONNECTED
0
ARCH
CONNECTED
0
ARCH
CONNECTED
0
SQL> alter database recover managed standby database using current logfile disconnect
from session;
Database altered.
SQL> select process,status,sequence#
2> from v$managed_standby;
PROCESS STATUS
SEQUENCE#
--------- ------------ ---------ARCH
CONNECTED
0
ARCH
CONNECTED
0
ARCH
CONNECTED
0
ARCH
CONNECTED
0
MRP0
APPLYING_LOG
103
SQL> select status,instance_name,database_role,open_mode
2>from v$database,v$instance;
STATUS
INSTANCE_NAME DATABASE_ROLE OPEN_MODE
------------ ---------------- ---------------- ---------MOUNTED
PCB_STBY
PHYSICAL STANDBY MOUNTED
SQL> alter database open read only;
alter database open read only
*
ERROR at line 1:
ORA-10456: cannot open standby database; media recovery session may be in
progress
You will end up getting the error message "ORA-10456: cannot open standby database;
media recovery session may be in progress" when you attempt to open the standby database
having MRP active. In this case you need stop MRP first, open a standby instance read-only, and
then turn on Active Data Guard as follows:
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database open read only;
Database altered.
SQL> alter database recover managed standby database using current logfile disconnect
from session;
Database altered.
SQL> select process,status,sequence# from v$managed_standby;
PROCESS STATUS
SEQUENCE#
--------- ------------ ---------ARCH
CLOSING
103
ARCH
CONNECTED
0
ARCH
CONNECTED
0
ARCH
CONNECTED
0
MRP0
APPLYING_LOG
104
RFS
IDLE
104
RFS
IDLE
0
7 rows selected.
SQL> select status,instance_name,database_role,open_mode from v$database,v$instance;
STATUS
INSTANCE_NAME DATABASE_ROLE OPEN_MODE
------------ ---------------- ---------------- -------------------OPEN
PCB_STBY
PHYSICAL STANDBY READ ONLY WITH APPLY
Add a comment
Loading
Dynamic Views template. Powered by Blogger.