Beruflich Dokumente
Kultur Dokumente
Use this page to record information about the databases in your configuration.
Primary Database
Database Name: _________________________________________________
Instance Name: _________________________________________________
Database Unique Name: __________________________________________
Target Name: ___________________________________________________
Host: __________________________________________________________
Oracle Home: ____________________________________________________
Standby Database
Database Name: _________________________________________________
Instance Name: _________________________________________________
Database Unique Name: __________________________________________
Target Name: ___________________________________________________
Host: __________________________________________________________
Oracle Home: ____________________________________________________
Standby Database
Database Name: _________________________________________________
Instance Name: _________________________________________________
Database Unique Name: __________________________________________
Target Name: ___________________________________________________
Host: __________________________________________________________
Oracle Home: ____________________________________________________
Standby Database
Database Name: _________________________________________________
Instance Name: _________________________________________________
Database Unique Name: __________________________________________
Target Name: ___________________________________________________
Host: __________________________________________________________
Oracle Home: ____________________________________________________
Your primary database is named pc<nn>prmy, where nn represents the number of the
PC you are using in the classroom.
You create a standby database named pc<nn>sby1, where nn represents the number of
the PC that you are using in the classroom (and your primary database is on).
For example, if you are using PC 5, your primary database is pc05prmy and your
standby database is pc05sby1.
1) Open a terminal window. Change to the labs directory. Verify that the
ORACLE_SID environment variable is set to your primary database. Invoke
SQL*Plus and connect as SYSDBA to your primary database. Determine if FORCE
LOGGING is enabled. If it is not enabled, enable FORCE LOGGING mode.
[oracle@edt3r17p0-pc00prmy ~]$ cd labs
[oracle@edt3r17p0-pc00prmy labs]$ echo $ORACLE_SID
pc00prmy
[oracle@edt3r17p0-pc00prmy labs]$
[oracle@edt3r17p0-pc00prmy labs]$ sqlplus / as sysdba
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining and Real Application Testing options
FOR
---
NO
Database altered.
FOR
---
YES
2) Configure the standby redo logs on the primary database. You can use the
cr_sby_redologs.sql script.
SQL> @cr_sby_redologs
SQL> ALTER DATABASE ADD STANDBY LOGFILE
2 '/u01/app/oracle/oradata/pc00prmy/srl01.log' size
52428800
3 /
Database altered.
Database altered.
Database altered.
Database altered.
System altered.
System altered.
SQL> show parameter log_archive_dest_1
Database altered.
Database altered.
5) Increase the size of the flash recovery area to 5 GB. Exit SQL*Plus.
SQL> alter system set db_recovery_file_dest_size = 5G;
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.1.0.6.0 - Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
[oracle@edt3r17p0-pc00prmy labs]$
6) Invoke RMAN and log in to your primary database.
[oracle@edt3r17p0-pc00prmy labs]$ rman
RMAN> exit
b) Expand Local. Select Service Naming and click the green plus sign in the left
navigation bar.
c) Enter pc<nn>sby1 in the Net Service Name field and click Next.
Note: For the value of nn, enter the number of the PC to which you are assigned.
g) Click Finish.
PC00SBY1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edt3r17p2.us.oracle.com)(PORT = 12001))
)
(CONNECT_DATA =
(SERVICE_NAME = pc00sby1.us.oracle.com)
)
)
i) Exit Oracle Net Manager.
2) Open a terminal window and use telnet to connect to the machine on which your
physical standby database will be created. Log in as the oracle user with a
password of oracle.
[oracle@edt3r17p0-pc00prmy labs]$ xhost +
[oracle@edt3r17p0-pc00prmy labs]$ telnet <standby host>
3) Launch Oracle Net Manager to configure an entry for your standby database in the
listener.ora file.
a) Expand Local.
b) Expand Listeners.
c) Select LISTENER1.
d) Select Database Services in the list.
e) Click Add Database.
f) Enter pc<nn>sby1.us.oracle.com in the Global Database Name field.
Accept the default for the Oracle Home Directory. Enter pc<nn>sby1 in the
SID field.
Starting /u01/app/oracle/product/11.1.0/db_1/bin/tnslsnr:
please wait...
Listening on:
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edt3r17p2.us.oracle.
com)(PORT=12001)))
Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC12001)))
STATUS of the LISTENER
------------------------
Alias LISTENER1
Version TNSLSNR for Linux: Version
11.1.0.6.0 - Production
Start Date 19-OCT-2007 14:32:25
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edt3r17p2.us.oracle.
com)(PORT=12001)))
Services Summary...
Service "pc00sby1.us.oracle.com" has 1 instance(s).
Instance "pc00sby1", status UNKNOWN, has 1 handler(s) for
this service...
The command completed successfully
[oracle@edt3r17p2-pc02prmy ~]$
5) Return to the terminal window for your primary database system. Change to the
$ORACLE_HOME/dbs directory and view the contents of the directory.
[oracle@edt3r17p0-pc00prmy ~]$ cd $ORACLE_HOME/dbs
[oracle@edt3r17p0-pc00prmy dbs]$ ls
hc_pc00db11.dat init.ora orapwpc00db11
spfilepc00db11.ora
hc_pc00prmy.dat lkPC00DB11 orapwpc00prmy
spfilepc00prmy.ora
initdw.ora lkPC00PRMY snapcf_pc00prmy.f
[oracle@edt3r17p0-pc00prmy dbs]$
6) FTP to the host where your standby database will be created. Specify a username of
oracle and a password of oracle to log on.
[oracle@edt3r17p0-pc00prmy dbs]$ ftp edt3r17p2
Connected to edt3r17p2.us.oracle.com.
220 edt3r17p2.us.oracle.com FTP server (Version wu-2.6.1-20)
ready.
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (edt3r17p2:oracle): oracle
331 Password required for oracle.
Password:
230 User oracle logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
7) FTP your primary database password file to the standby database system. Exit the
FTP session.
ftp> put orapwpc00prmy
local: orapwpc00prmy remote: orapwpc00prmy
227 Entering Passive Mode (10,150,21,130,31,89)
8) Return to your standby database system window. Rename the password file you
copied from your primary database system so that it can be used for your physical
standby database. Also relocate it to the $ORACLE_HOME/dbs directory. Verify that
you have successfully moved it and named it correctly.
[oracle@edt3r17p2-pc02prmy ~]$ ls
agent_installmedia Desktop diary labs oradiag_oracle
orapwpc00prmy
[oracle@edt3r17p2-pc02prmy ~]$ mv orapwpc00prmy
$ORACLE_HOME/dbs/orapwpc00sby1
[oracle@edt3r17p2-pc02prmy ~]$ cd $ORACLE_HOME/dbs
[oracle@edt3r17p2-pc02prmy dbs]$ ls
hc_pc02db11.dat init.ora orapwpc00sby1 snapcf_pc02prmy.f
hc_pc02prmy.dat lkPC02DB11 orapwpc02db11 spfilepc02db11.ora
initdw.ora lkPC02PRMY orapwpc02prmy spfilepc02prmy.ora
9) On the standby database host, create an initialization parameter file named
initpc<nn>sby1.ora containing a single parameter: DB_NAME=pc<nn>sby1.
[oracle@edt3r17p2-pc02prmy dbs]$ vi initpc00sby1.ora
[oracle@edt3r17p2-pc02prmy dbs]$ more initpc00sby1.ora
DB_NAME=pc00sby1
[oracle@edt3r17p2-pc02prmy dbs]$
11) Change to the pc<nn>sby1 directory and create the adump directory.
[oracle@edt3r17p2-pc02prmy admin]$ cd pc00sby1
[oracle@edt3r17p2-pc02prmy pc00sby1]$ mkdir adump
13) On the standby host, set the ORACLE_SID environment variable to pc<nn>sby1
and start the instance in NOMOUNT mode with the text initialization parameter file.
Exit SQL*Plus.
14) On the primary database host, verify that the ORACLE_SID environment variable is
set to pc<nn>prmy.
[oracle@edt3r17p0-pc00prmy dbs]$ echo $ORACLE_SID
pc00prmy
[oracle@edt3r17p0-pc00prmy dbs]$
15) On the primary database host, change to the $HOME/labs directory. Verify that the
cr_phys_sby1.txt script contains the correct values for your primary and
standby databases.
16) Invoke RMAN and connect as SYSDBA to the target database. Connect to the
auxiliary database.
[oracle@edt3r17p0-pc00prmy labs]$ rman
RMAN>
17) Execute the cr_phys_sby1.txt script.
RMAN> @cr_phys_sby1.txt
RMAN> run {
2> allocate channel prmy1 type disk;
3> allocate channel prmy2 type disk;
4> allocate channel prmy3 type disk;
5> allocate channel prmy4 type disk;
6> allocate auxiliary channel stby type disk;
7> duplicate target database for standby from active
database
8> spfile
9> parameter_value_convert 'pc00prmy','pc00sby1'
10> set db_unique_name='pc00sby1'
11> set db_file_name_convert='/pc00prmy/','/pc00sby1/'
12> set log_file_name_convert='/pc00prmy/','/pc00sby1/'
13> set
control_files='/u01/app/oracle/oradata/pc00sby1.ctl'
14> set log_archive_max_processes='5'
15> set fal_client='pc00sby1'
16> set fal_server='pc00prmy'
17> set standby_file_management='AUTO'
18> set
log_archive_config='dg_config=(pc00prmy,pc00sby1)'
19> set log_archive_dest_1='service=pc00prmy ASYNC
20> valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE)
db_unique_name=pc00prmy'
21> ;
22> }
using target database control file instead of recovery catalog
allocated channel: prmy1
channel prmy1: SID=123 device type=DISK
renamed tempfile 1 to
/u01/app/oracle/oradata/pc00sby1/pc00prmy/temp01.dbf in
control file
executing command: SET NEWNAME
RMAN> **end-of-file**
RMAN>
18) Exit your RMAN session and log in to SQL*Plus on your primary database system.
RMAN> exit
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
SQL>
19) Perform a log switch on the primary database.
SQL> alter system switch logfile;
System altered.
SQL>
20) Open a terminal window for the system that your physical standby database is on. Set
the ORACLE_SID environment variable to pc<nn>sby1. Change to the labs
directory. Log in to SQL*Plus as the SYSDBA user. Start Redo Apply.
[oracle@edt3r17p2-pc02prmy oradata]$ export
ORACLE_SID=pc00sby1
[oracle@edt3r17p2-pc00sby1 oradata]$ echo $ORACLE_SID
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
SQL> alter database recover managed standby database
2 using current logfile disconnect;
Database altered.
System altered.
System altered.
System altered.
3) On the standby database, verify that the new redo data was received and archived.
SQL> @query_archived_log
SQL> SELECT sequence#, first_time, next_time
2 FROM v$archived_log
3 ORDER BY sequence#
4 /
SEQUENCE# APP
---------- ---
12 YES
13 YES
14 YES
15 YES
16 YES
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
System altered.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
SQL> show parameter dg_broker_start
System altered.
2) Expand Local.
3) Expand Listeners.
4) Select LISTENER.
5) Select Database Services in the list.
6) Click Add Database.
7) Enter pc<nn>prmy_DGMGRL.us.oracle.com in the Global Database Name
field. Accept the default value for the Oracle Home Directory. Enter pc<nn>prmy
in the SID field.
Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
[oracle@edt3r17p0-pc00prmy labs]$ lsnrctl start
Starting /u01/app/oracle/product/11.1.0/db_1/bin/tnslsnr:
please wait...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edt3r17p0.us.oracle.
com)(PORT=1521)))
Services Summary...
Service "pc00prmy_DGMGRL.us.oracle.com" has 1 instance(s).
Instance "pc00prmy", status UNKNOWN, has 1 handler(s) for
this service...
The command completed successfully
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = pc00prmy_DGMGRL.us.oracle.com)
(ORACLE_HOME = /u01/app/oracle/product/11.1.0/db_1)
(SID_NAME = pc00prmy)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edt3r17p0.us.oracle.com)(PORT = 1521))
)
)
2) Expand Local.
3) Expand Listeners.
4) Select LISTENER1.
5) Select Database Services in the list.
6) Click Add Database.
7) Enter pc<nn>sby1_DGMGRL.us.oracle.com in the Global Database Name
field. Accept the default value for the Oracle Home Directory. Enter pc<nn>sby1
in the SID field.
Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC12001)))
The command completed successfully
[oracle@edt3r17p2-pc00sby1 labs]$
[oracle@edt3r17p2-pc00sby1 labs]$ lsnrctl start listener1
Starting /u01/app/oracle/product/11.1.0/db_1/bin/tnslsnr:
please wait...
Listening on:
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edt3r17p2.us.oracle.
com)(PORT=12001)))
Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC12001)))
STATUS of the LISTENER
------------------------
Alias LISTENER1
Version TNSLSNR for Linux: Version
11.1.0.6.0 - Production
Start Date 31-OCT-2007 16:33:49
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/11.1.0/db_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/edt3r17p2/listener1/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC12001)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edt3r17p2.us.oracle.
com)(PORT=12001)))
Services Summary...
7) Click Finish.
8) Select File > Save Network Configuration to save the information to the
tnsnames.ora file.
9) Exit Oracle Net Manager.
PC00PRMY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edt3r17p0.us.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = pc00prmy.us.oracle.com)
)
)
7) Click Finish.
8) Select File > Save Network Configuration to save the information to the
tnsnames.ora file.
9) Exit Oracle Net Manager.
PC00SBY1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edt3r17p2.us.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = pc00sby1.us.oracle.com)
)
)
11) Invoke SQL*Plus for your physical standby database and set the LOCAL_LISTENER
parameter to pc<nn>sby1. Be sure to set the ORACLE_SID environment variable
to pc<nn>sby1 before invoking SQL*Plus.
SQL> alter system set local_listener=pc00sby1;
System altered.
2) Create a broker configuration named DGConfig1 and include a profile for the
primary database.
DGMGRL> create configuration 'DGConfig1' as
> primary database is 'pc00prmy'
> connect identifier is pc00prmy;
Configuration "DGConfig1" created with primary database
"pc00prmy"
DGMGRL>
3) Display information about the configuration.
DGMGRL> show configuration
Configuration
Name: DGConfig1
Enabled: NO
Protection Mode: MaxPerformance
Databases:
pc00prmy - Primary database
DGMGRL>
4) Add your physical standby database to the broker configuration.
DGMGRL> add database 'pc00sby1' as
> connect identifier is pc00sby1;
Database "pc00sby1" added
DGMGRL>
Configuration
Name: DGConfig1
Enabled: NO
Protection Mode: MaxPerformance
Databases:
pc00prmy - Primary database
pc00sby1 - Physical standby database
DGMGRL>
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxPerformance
Databases:
pc00prmy - Primary database
pc00sby1 - Physical standby database
DGMGRL>
Note: If you receive one of the following messages Warning: ORA-16607: one
or more databases have failed or Warning: ORA-16792:
configurable property value is inconsistent with database
setting, you may need to restart one or both of your database instances. Discuss your
situation with your course instructor.
Your instructor will provide the name of the machine that Enterprise Manager Grid
Control is installed on. Record the name of the machine here and in step 7:
______________________________________________________________________
1) On your primary database host machine, open a terminal window and log on as the
oracle user with a password of oracle.
2) Oracle Enterprise Manager Grid Control software is staged in the
$HOME/agent_installmedia directory. Change to the
agent_installmedia/Disk1/linux/agent directory.
[oracle@edt3r17p0-pc00prmy ~]$ cd
agent_installmedia/Disk1/linux/agent
3) Invoke the Oracle Universal Installer.
[oracle@edt3r17p2-pc00prmy agent]$ ./runInstaller
Starting Oracle Universal Installer...
4) On the Specify Installation Type page, select Additional Management Agent and
click Next.
5) Accept the default location for the parent directory and click Next.
8) On the Specify Agent Registration Password page, enter oracle1 in the Password
field. Click Next. Be sure you have entered the password of oracle1 before
clicking Next.
11) Note that the Install page shows the progress of the installation.
12) The “Execute Configuration scripts” dialog box appears. Open a terminal window
and switch to the root user. In the Oracle University classroom, the password of the
root user is oracle.
13) Execute the script as instructed in the dialog box. Accept the default values when
prompted.
[oracle@edt3r17p0-pc00prmy ~]$ su -
Password:
[root@edt3r17p0 ~]# cd /u01/app/oracle/OracleHomes/agent10g
[root@edt3r17p0 agent10g]# ./root.sh
Running Oracle10 root.sh script...
15) The End of Installation page appears. Click Exit to exit the Oracle Universal Installer.
Click Yes to confirm.
Note: Before beginning this practice, you must confirm that the Oracle Management
Agent is successfully installed on your standby database host.
1) On the Databases page, select your standby database (by clicking the option button)
and click Configure.
2) Select SYSDBA in the Role list. Enter sys in the Monitor Username field and
oracle in the Monitor Password field. Enter 12001 in the Port field
3) Click Test Connection. You should receive a message indicating that the connection
test was successful. Click Next.
4) On the Configure Database Instance: Review page, click Submit. A page displays the
message “Target saving is in progress.”
5) The Database Instance Configuration Result page appears. Click OK.
6) You are returned to the Databases page. Ensure that the status for your database is
“Up” before proceeding to the next practice.”
5) On the Add Standby Database page, select Create a new physical standby database
and click Continue.
6) On the Add Standby Database: Backup Type page, select Perform a live backup of
the primary database and click Next.
7) On the Add Standby Database: Backup Options page, accept the default location for
the backup files directory. Accept the default option to delete the files after the
standby database creation. Enter the host credentials (Username: oracle and
Password: oracle) and select Save as Preferred Credential. Click Next.
8) On the Add Standby Database: Database Location page, enter pc<nn>sby2 in the
Instance Name field. Select the same host that you used for your other physical
standby database. Click Next.
9) On the Add Standby Database: File Locations page, accept the default to transfer
files. Scroll down the page.
10) In the Standby Database File Locations section, select Keep file names and
locations the same as the primary database and click Customize.
11) On the File Locations: Customize Tablespace Storage page, change the directory
location to pc<nn>sby2 for all file locations, in all sections (Datafiles, Tempfiles,
Log Files, Control Files, and Directory Objects) as necessary. Click OK.
13) You are returned to the Add Standby Database: File Locations page. Click Next.
14) On the Add Standby Database Configuration page, enter pc<nn>sby2 in the
Database Unique Name and Target Name fields. Accept the default for the Standby
Archive Location. Click Next.
15) On the Add Standby Database Review page, review the information about the
standby database to be created. If you are satisfied with the configuration information,
click Finish or click Back to make changes. The Processing: Add Standby Database
page appears.
Note: If Enterprise Manager remains on this page for more than 10 minutes, click the
Jobs tab to verify that the job is started.
16) You are returned to the Data Guard Overview page. Select Real Time: 1 Minute
Refresh in the View Data list to easily view the progress of standby database
creation. You can also click the Creation in progress link to monitor standby
database creation.
17) After the standby database creation is completed, not that the new physical standby
database is listed in the Standby Databases section.
1) Select your pc<nn>sby2 database (by clicking the option button) on the Data
Guard Overview page and click Remove to remove your pc<nn>sby2 database
from Data Guard broker control.
2) On the Confirmation page, click Yes. You receive a confirmation message that the
database has been removed from the Data Guard configuration.
In the practices for Lesson 6, “Creating a Logical Standby Database,” you use Enterprise
Manager Grid Control to create a logical standby database.
5) In the Add Standby Database: Backup Type section, accept the default of “Perform a
live backup of the primary database.” In the SQL Apply Unsupported Tables section,
select Table Columns and Data Types in the list and click Go to see the
unsupported tables.
6) For this practice, you can accept the unsupported columns. Click Next.
7) On the Add Standby Database: Backup Options page, accept the default location for
the backup files directory. Accept the default option to delete the files after standby
database creation. Enter the host credentials and select Save as Preferred
Credential. Click Next.
8) On the Add Standby Database: Database Location page, enter pc<nn>sby3 in the
Instance Name field. Select the same host that you used for your physical standby
databases. Click Next.
9) On the Add Standby Database: File Locations page, accept the default to transfer
files.
10) In the Standby Database File Locations section, select Keep file names and
locations the same as the primary database and click Customize.
11) On the File Locations: Customize Tablespace Storage page, change the directory
location to pc<nn>sby3 for all file locations on the page as necessary. Click OK.
12) On the Warning page, click Yes.
13) You are returned to the Add Standby Database: File Locations page. Click Next.
14) On the Add Standby Database Configuration page, enter pc<nn>sby3 in the
Database Name, Database Unique Name, and Target Name fields. Accept the default
for the Standby Archive Location. Click Next.
15) On the Add Standby Database Review page, review the information about the logical
standby database to be created. If you are satisfied with the configuration information,
click Finish. Otherwise, click Back to make changes. The Processing: Add Standby
Database page appears.
16) You are returned to the Data Guard Overview page. Select Real Time: 1 Minute
Refresh in the View Data list to easily view the progress of the logical standby
database creation.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
SQL>
3) Unlock the HR user account and set the password to hr. (lowercase)
SQL> ALTER USER hr IDENTIFIED BY hr ACCOUNT UNLOCK;
User altered.
4) Connect as the HR user with a password of hr.
SQL> connect hr/hr
Connected.
Table created.
6) Return to Enterprise Manager Grid Control and navigate to the Data Guard page.
7) Select your logical standby database and click Edit.
8) Click Standby Role Properties.
9) Expand Show Advanced Properties.
11) Enter information as shown in the following screen so that SQL Apply does not
execute DML statements for the HR.EMP_NAME table:
14) In your primary database session, log in to DGMGRL as the SYS user.
15) Verify the setting of the LsbyASkipCfgPr property. Exit DGMGRL.
DGMGRL> show database pc00sby3 LsbyAskipCfgPr;
LsbyASkipCfgPr = ''DML', 'HR', 'EMP_NAME', null'
16) In your primary database session, log in to SQL*Plus as the HR user again. Execute
the ins_emp_name.sql script to insert two rows in the HR.EMP_NAME table.
SQL> @ins_emp_name
SQL> INSERT INTO hr.emp_name
2 VALUES ('Don', 'Miller')
3 /
1 row created.
1 row created.
SQL> COMMIT
2 /
Commit complete.
System altered.
19) Open a terminal window and telnet to the machine that your standby database is on.
Log in as the oracle user with a password of oracle.
21) Invoke SQL*Plus on your logical standby database and log in as the HR user.
[oracle@edt3r17p2-pc00sby3 labs]$ sqlplus hr/hr
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
22) Query the HR.EMP_NAME table to verify that no rows were inserted in the table.
SQL> SELECT count(*) FROM emp_name;
COUNT(*)
----------
0
23) Exit SQL*Plus on your standby database.
2) Use the SHOW CONFIGURATION command to check the current protection mode for
your configuration.
DGMGRL> show configuration
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxPerformance
Databases:
pc00prmy - Primary database
pc00sby1 - Physical standby database
pc00sby3 – Logical standby database
5) Return to your DGMGRL window and set the LogXptMode database property to
SYNC for your pc<nn>sby1 database.
DGMGRL> edit database 'pc00sby1' set property
'LogXptMode'='SYNC';
Property "LogXptMode" updated
DGMGRL>
7) Use the SHOW CONFIGURATION command to verify your change to the protection
mode.
DGMGRL> show configuration
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxAvailability
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxPerformance
Databases:
5) Click the Standby Role Properties tab. Expand Show Advanced Properties. Note
the Log Transport Mode setting: __________________________
6) Click the Data Guard link to return to the Data Guard Overview page.
7) On the Data Guard Overview page, click the Protection Mode link.
8) On the Change Protection Mode: Select Mode page, select Maximum Availability
and click Continue.
9) On the Change Protection Mode: Standby Databases and Standby Redo Log Files
page, review the information and click Continue.
10) On the Confirmation: Change Protection Mode page, click Yes. The Processing:
Change Protection Mode page is displayed.
11) After the processing is completed, you are returned to the Data Guard Overview page
and receive a confirmation message. Select your physical standby database and click
Edit.
12) Click the Standby Role Properties tab. Expand Show Advanced Properties. Note
that the Log Transport Mode setting has changed.
13) Click the Data Guard link to return to the Data Guard Overview page.
2) The Log File Details page is displayed. Note the state of Log Transport and Log
Apply services in your configuration.
3) Invoke DGMGRL on your primary database host and log in as sys with a password
of oracle.
[oracle@edt3r17p0-pc00prmy admin]$ dgmgrl
DGMGRL for Linux: Version 11.1.0.6.0 - Production
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
7) Perform a log switch.
SQL> alter system switch logfile;
System altered.
8) Exit SQL*Plus.
9) Return to Enterprise Manager Grid Control and refresh your page. Note the status for
Log Apply Services and the status of the log files. (Your results may vary slightly
from what is shown.)
10) Invoke DGMGRL again on your primary database host and log in as sys with the
password of oracle.
11) Set the state of your physical standby database to APPLY-ON.
DGMGRL> edit database 'pc00sby1'
> set state='APPLY-ON';
Succeeded.
12) Exit DGMGRL.
13) Return to Enterprise Manager Grid Control and refresh your page. Note the status of
Log Apply Services. All logs should have been received and applied.
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
pc00prmy - Primary database
pc00sby1 - Physical standby database
pc00sby3 – Logical standby database
Database altered.
4) Return to your primary database window and check your configuration status.
DGMGRL> show configuration
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
pc00prmy - Primary database
pc00sby1 - Physical standby database
pc00sby3 – Logical standby database
5) Execute the SHOW DATABASE command to further investigate the status of your
configuration by checking your primary database.
DGMGRL> show database pc00prmy
Database
Name: pc00prmy
OEM Name: pc00prmy.us.oracle.com
Role: PRIMARY
Enabled: YES
Intended State: TRANSPORT-ON
Instance(s):
pc00prmy
Database
Name: pc00sby1
OEM Name: pc00sby1.us.oracle.com
Role: PHYSICAL STANDBY
Enabled: YES
Intended State: APPLY-ON
Instance(s):
pc00sby1
8) Click the ORA-16766: Redo Apply is stopped link in the Data Guard Status column.
9) Click the Reset button to restart Redo Apply.
10) You receive a message that the reset was successful. Click the Data Guard link to
return to the Data Guard Overview page. The Status for the physical standby database
now is Normal.
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
pc00prmy - Primary database
pc00sby1 - Physical standby database
pc00sby3 – Logical standby database
DEST_NAME COMPRES
------------------------------ -------
LOG_ARCHIVE_DEST_1 DISABLE
LOG_ARCHIVE_DEST_2 DISABLE
LOG_ARCHIVE_DEST_3 DISABLE
LOG_ARCHIVE_DEST_4 DISABLE
LOG_ARCHIVE_DEST_5 DISABLE
LOG_ARCHIVE_DEST_6 DISABLE
LOG_ARCHIVE_DEST_7 DISABLE
LOG_ARCHIVE_DEST_8 DISABLE
LOG_ARCHIVE_DEST_9 DISABLE
LOG_ARCHIVE_DEST_10 DISABLE
10 rows selected.
2) Invoke DGMGRL on your primary database host.
[oracle@edt3r17p0-pc00prmy pc00prmy]$ dgmgrl
DGMGRL for Linux: Version 11.1.0.6.0 - Production
4) Return to your SQL*Plus session and query V$ARCHIVE_DEST again. Note that
compression is set for LOG_ARCHIVE_DEST_1.
SQL> select dest_name, compression
2 from v$archive_dest;
DEST_NAME COMPRES
------------------------------ -------
LOG_ARCHIVE_DEST_1 ENABLE
10 rows selected.
3) Shut down your primary database instance and restart it in MOUNT mode.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Database altered.
5) Open the database.
SQL> alter database open;
Database altered.
Database altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.1.0.6.0 - Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
[oracle@edt3r17p2-pc00sby1 ~]$
3) Invoke DGMGRL again and restart Redo Apply.
DGMGRL> edit database 'pc00sby1' set state='apply-on';
Succeeded.
DGMGRL> exit
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
Table created.
3) Connect to your database as the SYSDBA user and perform a log switch on your
primary database. Exit SQL*Plus.
SQL> connect / as sysdba
Connected.
SQL> alter system switch logfile;
System altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.1.0.6.0 - Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
4) Invoke DGMGRL on your primary database host and connect as the SYS user with
the password oracle.
[oracle@edt3r17p0-pc00prmy labs]$ dgmgrl
DGMGRL for Linux: Version 11.1.0.6.0 - Production
Database
Name: pc00prmy
OEM Name: pc00prmy.us.oracle.com
Role: PRIMARY
Enabled: YES
Intended State: TRANSPORT-ON
Instance(s):
pc00prmy
Properties:
DGConnectIdentifier = 'pc00prmy'
ObserverConnectIdentifier = ''
LogXptMode = 'SYNC'
DelayMins = '0'
Binding = 'OPTIONAL'
MaxFailure = '0'
MaxConnections = '1'
ReopenSecs = '300'
NetTimeout = '30'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance = ''
ApplyInstanceTimeout = '0'
ApplyParallel = 'AUTO'
StandbyFileManagement = 'MANUAL'
ArchiveLagTarget = '0'
LogArchiveMaxProcesses = '4'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = ''
LogFileNameConvert = ''
FastStartFailoverTarget = ''
StatusReport = '(monitor)'
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
HostName =
'edt3r17p0.us.oracle.com'
SidName = 'pc00prmy'
StandbyArchiveLocation =
'USE_DB_RECOVERY_FILE_DEST'
Database
Name: pc00sby1
OEM Name: pc00sby1.us.oracle.com
Role: PHYSICAL STANDBY
Enabled: YES
Intended State: APPLY-ON
Instance(s):
pc00sby1
Properties:
DGConnectIdentifier = 'pc00sby1'
ObserverConnectIdentifier = ''
LogXptMode = 'SYNC'
DelayMins = '0'
Binding = 'OPTIONAL'
MaxFailure = '0'
MaxConnections = '1'
ReopenSecs = '300'
NetTimeout = '30'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance = ''
ApplyInstanceTimeout = '0'
ApplyParallel = 'AUTO'
StandbyFileManagement = 'AUTO'
ArchiveLagTarget = '0'
8) Execute the switchover command to make your physical standby database your
primary database.
DGMGRL> switchover to pc00sby1
Performing switchover NOW, please wait...
New primary database "pc00sby1" is opening...
Operation requires shutdown of instance "pc00prmy" on database
"pc00prmy"
Shutting down instance "pc00prmy"...
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "pc00prmy" on database
"pc00prmy"
Starting instance "pc00prmy"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "pc00sby1"
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxPerformance
Databases:
pc00sby1 - Primary database
pc00prmy - Physical standby database
pc00sby3 – Logical standby database
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
COUNT(*)
----------
107
3) Click the Primary link in the High Availability section of the database home page.
4) Select your new physical standby database (pc<nn>prmy) and click Switchover.
7) Note that the Data Guard page displays a message indicating that the switchover
operation was completed successfully.
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
pc00prmy - Primary database
pc00sby1 - Physical standby database
pc00sby3 - Logical standby database
3) Verify that the LogXptMode property is set to SYNC for the primary database and
the physical standby database.
DGMGRL> show database pc00prmy LogXptMode
LogXptMode = 'SYNC'
DGMGRL> show database pc00sby1 LogXptMode
LogXptMode = 'SYNC'
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
pc00prmy - Primary database
pc00sby1 - Physical standby database
- Fast-Start Failover target
pc00sby3 - Logical standby database
Database
Name: pc00prmy
Role: PRIMARY
Enabled: YES
Intended State: TRANSPORT-ON
Instance(s):
pc00prmy
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
pc00prmy - Primary database
pc00sby1 - Physical standby database
- Fast-Start Failover target
pc00sby3 - Logical standby database
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
2) To simulate a failure of the primary database, shut down your primary database
instance with the ABORT option.
SQL> shutdown abort
ORACLE instance shut down.
3) Return to the window on your physical standby database system where you started
the observer. View the actions. The failover make take a few minutes.
11:30:34.98 Friday, November 30, 2007
Initiating Fast-Start Failover to database "pc00sby1"...
Performing failover NOW, please wait...
Failover succeeded, new primary is "pc00sby1"
11:31:12.88 Friday, November 30, 2007
4) Open another terminal window for the system that your physical standby database is
on. Set the ORACLE_SID environment variable to pc<nn>sby1. Invoke DGMGRL
and connect as the SYS user.
[oracle@edt3r17p2-pc00sby1 ~]$ dgmgrl
DGMGRL for Linux: Version 11.1.0.6.0 - Production
Configuration
Database
Name: pc00sby1
Role: PRIMARY
Enabled: YES
Intended State: TRANSPORT-ON
Instance(s):
pc00sby1
Database
Name: pc00prmy
Role: PHYSICAL STANDBY
Enabled: NO
Intended State: APPLY-ON
Instance(s):
pc00prmy
8) Invoke SQL*Plus on the system that your pc<nn>prmy database is on and connect
as the SYSDBA user.
[oracle@edt3r17p0-pc00prmy labs]$ sqlplus / as sysdba
9) Start the instance and MOUNT the database. Note that you may see messages in the
observer window.
SQL> startup mount
ORACLE instance started.
10) Return to the DGMGRL session for your pc<nn>sby1 database and reinstate the
pc<nn>prmy database if needed. You receive an error if it is already reinstated.
DGMGRL> REINSTATE DATABASE ‘pc00prmy’;
Reinstating database "pc00prmy", please wait...
Error: ORA-16657: reinstatement of database in progress
Failed.
Database reinstatement for "pc00prmy" in progress.
11) Monitor the window that you started the observer in and note that the broker is
reinstating the database for you.
11:31:12.88 Friday, November 30, 2007
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "pc00prmy" on database
"pc00prmy"
Starting instance "pc00prmy"...
ORACLE instance started.
Database mounted.
Continuing to reinstate database "pc00prmy" ...
Reinstatement of database "pc00prmy" succeeded
11:47:53.45 Friday, November 30, 2007
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
pc00sby1 - Primary database
pc00prmy - Physical standby database
- Fast-Start Failover target
pc00sby3 - Logical standby database
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
pc00sby1 - Primary database
pc00prmy - Physical standby database
- Fast-Start Failover target
pc00sby3 - Logical standby database
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "pc00sby1" on database
"pc00sby1"
Starting instance "pc00sby1"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "pc00prmy"
3) Verify the status of your configuration.
DGMGRL> show configuration
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
pc00prmy - Primary database
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
2) Determine if Flashback Database is enabled for the physical standby database by
querying V$DATABASE. Exit SQL*Plus.
SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------
YES
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
Database altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.1.0.6.0 - Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
c) Invoke DGMGRL again and restart the MRP process.
[oracle@edt3r17p0-orclsby1 labs]$ dgmgrl
DGMGRL for Linux: Version 11.1.0.6.0 - Production
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
pc00prmy - Primary database
pc00sby1 - Snapshot standby database
pc00sby3 - Logical standby database
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
1 row created.
SQL> commit;
Commit complete.
3) Return to your SQL*Plus session in your standby database window. Insert a row in
the HR.REGIONS table on the snapshot standby database:
SQL> insert into hr.regions
2 values (20, 'Australia');
1 row created.
SQL> commit;
Commit complete.
4) Query the HR.REGIONS table in your snapshot standby database.
SQL> select * from hr.regions;
REGION_ID REGION_NAME
---------- -------------------------
20 Australia
1 Europe
2 Americas
3 Asia
4 Middle East and Africa
5) On the standby database, verify that redo data is being shipped to the snapshot
standby database by again querying V$MANAGED_STANDBY. Record the value in the
BLOCK# column: __________________ Exit SQL*Plus.
SQL> select status, sequence#, block#
2 from v$managed_standby
3 where client_process='LGWR';
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "pc00sby1" on database
"pc00sby1"
Starting instance "pc00sby1"...
ORACLE instance started.
Database mounted.
Database "pc00sby1" converted successfully
DGMGRL>
3) Verify the status of the standby database by executing the SHOW CONFIGURATION
command.
4) Exit from DGMGRL and invoke SQL*Plus in your primary database window.
[oracle@edt3r17p0-pc00prmy labs]$ sqlplus / as sysdba
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
5) Perform a log switch on the primary database.
SQL> alter system switch logfile;
System altered.
6) Check the HR.REGIONS table to verify that the change made to the primary database
was propagated to the physical standby database and to verify that the row inserted in
the HR.REGIONS table when it was a snapshot standby database is no longer in the
table. Invoke DGMGRL in your standby database window and connect as the sys
user.
[oracle@edt3r17p2-pc00sby1 ~]$ dgmgrl
DGMGRL for Linux: Version 11.1.0.6.0 - Production
7) So that you can query the HR.REGIONS table, stop Redo Apply. Exit DGMGRL.
DGMGRL> edit database pc00sby1 set state='apply-off';
Succeeded.
DGMGRL> exit
8) Invoke SQL*Plus in your standby database window and connect as the SYSDBA user.
Open the physical standby database in read-only mode.
[oracle@edt3r17p2-pc00sby1 ~]$ sqlplus / as sysdba
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
Database altered.
9) Query the HR.REGIONS table in your standby database.
Note that the change you made when the database was a snapshot standby database is
not present in the table. Note that the row that you inserted into the HR.REGIONS on
the primary database is present in the table.
SQL> select * from hr.regions;
REGION_ID REGION_NAME
---------- -------------------------
1 Europe
2 Americas
3 Asia
4 Middle East and Africa
10 Australia
10) Shut down the physical standby database and restart it in MOUNT mode. Exit
SQL*Plus.
SQL> shutdown immediate
Database closed.
Database dismounted.
Database
Name: pc00sby1
Role: PHYSICAL STANDBY
Enabled: YES
Intended State: APPLY-ON
Instance(s):
pc00sby1
2) Remove your logical standby database, pcnnsby3 from your configuration. You
will be able to use Real-Time Query to query your physical standby database.
DGMGRL> remove database 'pc00sby3';
Removed database "pc00sby3" from the configuration
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
pc00prmy - Primary database
pc00sby1 - Physical standby database
Database
Name: pc00sby1
Role: PHYSICAL STANDBY
Enabled: YES
Intended State: APPLY-OFF
Instance(s):
pc00sby1
DGMGRL> exit
[oracle@edt3r17p2-pc00sby1 admin]$
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
6) Open your physical standby database in read-only mode. Exit SQL*Plus.
SQL> alter database open read only;
Database altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.1.0.6.0 - Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
[oracle@edt3r17p2-pc00sby1 admin]$
7) In your standby database window, invoke DGMGRL and connect as the sys user
with a password of oracle.
[oracle@edt3r17p2-pc00sby1 admin]$ dgmgrl
DGMGRL for Linux: Version 11.1.0.6.0 - Production
Database
Name: pc00sby1
Role: PHYSICAL STANDBY
Enabled: YES
Intended State: APPLY-ON
Instance(s):
pc00sby1
9) In your standby database window, invoke SQL*Plus and connect as SYSDBA. Query
the HR.REGIONS table.
[oracle@edt3r17p2-pc00sby1 labs]$ sqlplus / as sysdba
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
REGION_ID REGION_NAME
---------- -------------------------
1 Europe
2 Americas
3 Asia
4 Middle East and Africa
10 Australia
SQL>
10) In your primary database window, invoke SQL*Plus and connect as SYSDBA. Insert
a row in the HR.REGIONS table.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
1 row created.
SQL> commit;
Commit complete.
11) Return to your standby database window and query the HR.REGIONS table again. In
your standby database, you should see the new row that you inserted in the
HR.REGIONS table on your primary database.
SQL> select * from hr.regions;
REGION_ID REGION_NAME
---------- -------------------------
1 Europe
2 Americas
3 Asia
4 Middle East and Africa
10 Australia
20 Antarctica
6 rows selected.
12) Return your physical standby database to MOUNT mode. Exit SQL*Plus.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
pc00prmy - Primary database
pc00sby1 - Physical standby database
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
2) Enable block change tracking and specify
/u01/app/oracle/oradata/pc<nn>sby1/chg_track.chg for the file
name. Be sure to specify your standby database name (pc<nn>sby1) as the
directory name.
SQL> alter database enable block change tracking
2 using file
'/u01/app/oracle/oradata/pc00sby1/chg_track.chg';
Database altered.
4) Exit SQL*Plus.
5) Create a tablespace named RCTS to hold the recovery catalog data. Specify a data file
name of ‘/u01/app/oracle/oradata/pcnndb11/rcts.dbf’ and size of
30 MB. You can use the rcts_create.sql script.
SQL> set echo on
SQL> @rcts_create
SQL> create tablespace rcts
2 datafile '/u01/app/oracle/oradata/pc00db11/rcts.dbf' size
30M
Tablespace created.
SQL>
6) Create the recovery catalog owner user named RCOWNER with a password of
rcpass. The default tablespace for the user is RCTS. Provide unlimited quota on the
RCTS tablespace to the user. You can use the rcowner_create.sql script.
SQL> @rcowner_create
SQL> create user rcowner identified by rcpass
2 default tablespace rcts
3 quota unlimited on rcts
4 /
User created.
7) Grant the RECOVERY_CATALOG_OWNER role to the RCOWNER user. Exit
SQL*Plus.
SQL> grant recovery_catalog_owner to rcowner;
Grant succeeded.
8) Invoke RMAN and connect to the pcnndb11 database as the recovery catalog
owner. Remember that the password for RCOWNER is rcpass.
[oracle@edt3r17p0-pc00db11 labs]$ rman catalog rcowner
RMAN> exit
RMAN>
3) Register your primary database.
RMAN> register database;
RMAN>
List of Databases
DB Key DB Name DB ID Database Role Db_unique_name
------- ------- -------------- --------------- --------------
1 PC00PRMY 1159023676 PRIMARY PC00PRMY
5) Use the REPORT SCHEMA FOR DB_UNIQUE_NAME command to verify the files.
RMAN> report schema for db_unique_name pc00prmy;
6) Use the LIST ARCHIVELOG ALL FOR DB_UNIQUE_NAME command to verify that
the archived log files are registered.
RMAN> list archivelog all for db_unique_name pc00prmy;
159 1 28 A 27-NOV-07
Name:
/u01/app/oracle/flash_recovery_area/PC00PRMY/archivelog/2007_1
1_27/o1_mf_1_28_3np7g0jc_.arc
…
7) Use the SHOW ALL FOR DB_UNIQUE_NAME command to display the RMAN
configuration parameters for your primary database.
RMAN> show all for db_unique_name pc00prmy;
RMAN>
2) Specify that archived redo log files can be deleted after they are applied to the
standby database.
RMAN> configure archivelog deletion policy to
2> applied on all standby;
RMAN>
3) Configure the connect identifier for your primary database.
RMAN> configure db_unique_name pc00prmy
2> connect identifier 'pc00prmy';
RMAN>
4) Configure the connect identifier for your physical standby database.
RMAN> configure db_unique_name pc00sby1
2> connect identifier 'pc00sby1';
RMAN>
5) Your physical standby database is registered with the recovery catalog. Use the LIST
DB_UNIQUE command to see the registration information about your primary and
standby databases.
RMAN> list db_unique_name of database;
List of Databases
DB Key DB Name DB ID Database Role Db_unique_name
------- ------- ------------- ------------- -------------
1 PC00PRMY 1159023676 PRIMARY PC00PRMY
1 PC00PRMY 1159023676 STANDBY PC00SBY1
RMAN>
6) Use the REPORT SCHEMA command to view additional information about your
physical standby database.
Note: Your output may vary from this example and may not include the actual data
file names.
RMAN> report schema for db_unique_name pc00sby1;
RMAN>
7) Exit RMAN.
8) Invoke RMAN again and connect to your physical standby database and the recovery
catalog.
[oracle@edt3r17p0-pc00prmy labs]$ rman target
sys/oracle@pc00sby1 catalog rcowner/rcpass@pc00db11
RMAN>
9) Execute the SHOW ALL command to view the configuration parameters for your
physical standby database.
RMAN> show all for db_unique_name pc00sby1;
RMAN>
10) Configure automatic backup of the control file and the server parameter file.
RMAN> configure controlfile autobackup on;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
RMAN>
11) Configure backup optimization.
RMAN> configure backup optimization on;
RMAN>
12) Set the archived log deletion policy to BACKED UP 1 TIMES TO DEVICE TYPE
DISK.
RMAN> configure archivelog deletion policy to backed up 1
times to device type disk;
RMAN>
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
4) Query the HR.EMPLOYEES table. Because you moved the data file, you receive an
error.
SQL> select count(*) from hr.employees;
select count(*) from hr.employees
*
ERROR at line 1:
ORA-01116: error in opening database file 5
ORA-01110: data file 5:
'/u01/app/oracle/oradata/pc00prmy/example01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
5) Exit SQL*Plus.
6) Invoke RMAN and connect to your physical standby database as the target and your
primary database as the auxiliary database.
RMAN>
11) Use the RMAN SET NEWNAME and SWITCH DATAFILE commands to update the
data file name in the RMAN repository.
RMAN> run {
2> set newname for datafile 5 to
'/u01/app/oracle/oradata/pc00prmy/newex01.dbf';
3> switch datafile 5;
4> }
RMAN-00571:
===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
===============
RMAN-00571:
===========================================================
RMAN-03009: failure of switch command on default channel at
02/15/2008 22:27:20
ORA-19623: file 5 is open
12) Take the tablespace offline to perform step 11. Take the EXAMPLE tablespace offline.
RMAN> sql ‘alter tablespace example offline immediate’;
13) Try once again to execute the SET NEWNAME and SWITCH DATAFILE commands.
RMAN> run {
2> set newname for datafile 5 to
'/u01/app/oracle/oradata/pc00prmy/newex01.dbf';
3> switch datafile 5;
4> }
RMAN>
15) Because you took the tablespace offline with the IMMEDIATE option, you must
recover the tablespace. Recover the EXAMPLE tablespace.
RMAN> recover tablespace example;
Starting recover at 17-SEP-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=115 device type=DISK
RMAN> exit
COUNT(*)
----------
107
4) Check to see if the listener knows about the new service by executing the lsnrctl
services command. Although you created the service, you have not yet started it,
so the listener does not know about it.
SQL> host
[oracle@edt3r17p0-pc00prmy labs]$ lsnrctl services
Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
Services Summary...
Service "pc00db11.us.oracle.com" has 1 instance(s).
Instance "pc00db11", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
…
Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
Services Summary...
Service "PC00PROD.us.oracle.com" has 1 instance(s).
Instance "pc00prmy", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:8 refused:0 state:ready
LOCAL SERVER
Trigger created.
SQL>
9) On the Address 2 tab, enter the fully qualified host of the machine that your physical
standby database is on. Enter 12001 in the Port Number field.
10) Select File > Save Network Configuration to save the information to the
tnsnames.ora file.
11) Exit Oracle Net Manager.
12) Ensure that your updated $ORACLE_HOME/network/admin/tnsnames.ora
file contains an entry similar to the following for PC<nn>PROD.
PC00PROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edt3r17p0.us.oracle.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST =
edt3r17p2.us.oracle.com)(PORT = 12001))
)
(CONNECT_DATA =
(SERVICE_NAME = pc00prod.us.oracle.com)
)
)
User created.
Grant succeeded.
Grant succeeded.
2) On your physical standby database host, connect to the primary database as the
DGTEST user by using the pc<nn>PROD service.
[oracle@edt3r17p2-pc00sby1 labs]$ sqlplus
dgtest/dgtest@pc00prod
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
With the Partitioning, Oracle Label Security, OLAP, Data
Mining
and Real Application Testing options
HOST_NAME
-----------------------------------------------------------
edt3r17p0.us.oracle.com
4) Query V$SESSION to determine how you are connected. You can use the
query_session.sql script.
SQL> select failover_type, failover_method, failed_over
2 from v$session
3 where username = 'DGTEST';
5) Return to your primary database host and invoke DGMGRL. Connect as the SYS user
with a password of ORACLE and perform a switchover to your PC<nn>SBY1
database. Exit from DGMGRL.
[oracle@edt3r17p0-pc00prmy labs]$ dgmgrl
DGMGRL for Linux: Version 11.1.0.6.0 - Production
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "pc00prmy" on database
"pc00prmy"
Starting instance "pc00prmy"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "pc00sby1"
DGMGRL> exit
6) On your primary database host, check the listener services again. PC<nn>PROD is no
longer listed.
[oracle@edt3r17p0-pc00prmy labs]$ lsnrctl services
Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
Services Summary...
Service "pc00db11.us.oracle.com" has 1 instance(s).
Instance "pc00db11", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
…
7) Return to your (original) physical standby database host. In your existing SQL*Plus
session, query V$INSTANCE to determine what host you are now connected to.
SQL> select host_name from v$instance;
HOST_NAME
-----------------------------------------------------------
edt3r17p2.us.oracle.com
10) Execute the lsnrctl services listener1 command on your original standby
database host. Note that PC00PROD is now started on this host.
[oracle@edt3r17p2-pc00sby1 labs]$ lsnrctl services listener1
Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC12001)))
Services Summary...
Service "PC00PROD.us.oracle.com" has 1 instance(s).
Instance "pc00sby1", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:18 refused:0 state:ready
LOCAL SERVER
11) Return to your (original) primary database host and log in to SQL*Plus as the
SYSDBA user. View the value of the SERVICE_NAMES parameter.
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "pc00sby1" on database
"pc00sby1"
Starting instance "pc00sby1"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "pc00prmy"
14) Verify the status of your configuration. Exit DGMGRL.
DGMGRL> show configuration
Configuration
Name: DGConfig1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
pc00prmy - Primary database
pc00sby1 - Physical standby database
DGMGRL> exit
[oracle@edt3r17p2-pc00sby1 labs]$
15) Return to your primary database window. Log in to SQL*Plus as the SYSDBA user.