Configuration process of maximum performance mode of physical volume uard
Master Database Host edbjr2p1
Slave Database Host edbjr2p2
1. Create a master database
[Root @ edbjr2p1 ~] # Xhost +
Access control disabled, clients can connect from any host
[Root @ edbjr2p1 ~] # Su-oracle
[Oracle @ edbjr2p1 ~] $ Dbca
The database creation process is omitted... ORACLE_SID = ORCL
2. master database Parameters
[Oracle @ edbjr2p1 ~] $ Export ORACLE_SID = ORCL
[Oracle @ edbjr2p1 ~] $ Sqlplus/as sysdba
SQL * Plus: Release 10.2.0.1.0-Production on Tue Dec 31 09:20:03 2013
Copyright (c) 1982,200 5, Oracle. All rights reserved.
Connected:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
With the Partitioning, OLAP and Data Mining options
SYS @ ORCL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS @ ORCL> startup mount
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218968 bytes
Variable Size 88082024 bytes
Database Buffers 188743680 bytes
Redo Buffers 7168000 bytes
Database mounted.
SYS @ ORCL> select status from v $ instance;
STATUS
------------
MOUNTED
SYS @ ORCL> alter database force logging;
Database altered.
SYS @ ORCL> select log_mode from v $ database;
LOG_MODE
------------
NOARCHIVELOG
SYS @ ORCL>
SYS @ ORCL> alter database archivelog;
Database altered.
SYS @ ORCL> alter system set log_archive_config = 'dg _ config = (orcl, aux1 )';
System altered.
SYS @ ORCL> alter system set log_archive_dest_10 = 'location =/home/oracle/orcl_arclog valid_for = (online_logfiles, all_roles) db_unique_name = orcl ';
System altered.
SYS @ ORCL>
Create a directory to store archives
[Oracle @ edbjr2p1 admin] $ mkdir/home/oracle/orcl_arclog
Change Parameters
SYS @ ORCL> alter system set log_archive_dest_1 = 'service = aux1 valid_for = (online_logfiles, primary_role) db_unique_name = aux1 ';
System altered.
SYS @ ORCL> alter system set log_archive_max_processes = 4;
System altered.
SYS @ ORCL> create pfile from spfile;
File created.
Transfer pfile and password files
[Oracle @ edbjr2p1 admin] $ scp $ ORACLE_HOME/dbs/initORCL. ora edbjr2p2: $ ORACLE_HOME/dbs/initAUX1.ora
Oracle @ edbjr2p2's password:
InitORCL. ora 100% 1178 1.2KB/s
[Oracle @ edbjr2p1 admin] $ scp $ ORACLE_HOME/dbs/orapwORCL edbjr2p2: $ ORACLE_HOME/dbs/orapwAUX1
Oracle @ edbjr2p2's password:
OrapwORCL 100% 1536 1.5KB/s
[Oracle @ edbjr2p1 admin] $
3. Modify the transmitted pfile in the standby Database
[Root @ edbjr2p2 ~] # Su-oracle
[Oracle @ edbjr2p2 ~] $ Cd $ ORACLE_HOME/dbs
[Oracle @ edbjr2p2 dbs] $ ls
InitAUX1.ora initdw. ora init. ora orapwAUX1
[Oracle @ edbjr2p2 dbs] $ vi initAUX1.ora
The following are modified in the file:
*. Audit_file_dest = '/u01/app/oracle/admin/AUX1/adump'
*. Background_dump_dest = '/u01/app/oracle/admin/AUX1/bdump'
*. Control_files = '/u01/app/oracle/oradata/AUX1/control01.ctl', '/u01/app/oracle/oradata/AUX1/control02.ctl ', '/u01/app/oracle/oradata/AUX1/control03.ctl'
*. Core_dump_dest = '/u01/app/oracle/admin/AUX1/cdump'
*. Log_archive_dest_10 = 'location =/home/oracle/aux?arclog valid_for = (online_logfiles, all_roles) db_unique_name = aux1'
*. User_dump_dest = '/u01/app/oracle/admin/AUX1/udump'
The following are
*. Db_unique_name = 'aux1'
*. Standby_archive_dest = '/home/oracle/aux1_stdlog'
*. Db_file_name_convert = ('/u01/app/oracle/oradata/ORCL/', '/u01/app/oracle/oradata/AUX1 /')
*. Log_file_name_convert = ('/u01/app/oracle/oradata/ORCL/', '/u01/app/oracle/oradata/AUX1 /')
*. Standby_file_management = 'auto'
Create a directory in the slave Database
[Oracle @ edbjr2p2 dbs] $ mkdir-p $ ORACLE_BASE/admin/AUX1/{a, B, c, u} dump
[Oracle @ edbjr2p2 dbs] $ mkdir/home/oracle/auxw.arclog
[Oracle @ edbjr2p2 dbs] $ mkdir/home/oracle/aux1_stdlog
[Oracle @ edbjr2p2 dbs] $ mkdir $ ORACLE_BASE/oradata/AUX1
4. Create listeners and TNS
In the master database:
[Oracle @ edbjr2p1 admin] $ netca
Next, create a listener.
Create TNS
Because the master and slave databases use the same tnsnames, The tnsname. ora is transferred from the master database to the slave database.
[Oracle @ edbjr2p1 admin] $ scp $ ORACLE_HOME/network/admin/tnsnames. ora edbjr2p2: $ ORACLE_HOME/network/admin/tnsnames. ora
Oracle @ edbjr2p2's password:
Tnsnames. ora 100% 700 0.7KB/s
[Oracle @ edbjr2p1 admin] $
Slave database:
The process of creating a listener on the slave database is omitted...
5. Install rman backup in the master database
[Oracle @ edbjr2p1 admin] $ export ORACLE_SID = ORCL
[Oracle @ edbjr2p1 admin] $ rman target/
Recovery Manager: Release 10.2.0.1.0-Production on Tue Dec 31 09:56:56 2013
Copyright (c) 1982,200 5, Oracle. All rights reserved.
Connected to target database: ORCL (DBID = 1363387608, not open)
RMAN> backup database;
Starting backup at 31-DEC-13
Using target database control file instead of recovery catalog
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: sid = 155 devtype = DISK
Channel ORA_DISK_1: starting full datafile backupset
Channel ORA_DISK_1: specifying datafile (s) in backupset
Input datafile fno = 00001 name =/u01/app/oracle/oradata/ORCL/system01.dbf
Input datafile fno = 00002 name =/u01/app/oracle/oradata/ORCL/undotbs01.dbf
Input datafile fno = 00003 name =/u01/app/oracle/oradata/ORCL/sysaux01.dbf
Input datafile fno = 00004 name =/u01/app/oracle/oradata/ORCL/users01.dbf
Channel ORA_DISK_1: starting piece 1 at 31-DEC-13
Channel ORA_DISK_1: finished piece 1 at 31-DEC-13
Piece handle =/u01/app/oracle/product/10.2.0/db_1/dbs/01osspjr_1_1 tag = TAG20131231T095715 comment = NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:01:06
Channel ORA_DISK_1: starting full datafile backupset
Channel ORA_DISK_1: specifying datafile (s) in backupset
Including current control file in backupset
Including current SPFILE in backupset
Channel ORA_DISK_1: starting piece 1 at 31-DEC-13
Channel ORA_DISK_1: finished piece 1 at 31-DEC-13
Piece handle =/u01/app/oracle/product/10.2.0/db_1/dbs/02ossplt_1_1 tag = TAG20131231T095715 comment = NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 31-DEC-13
RMAN> exit;
Recovery Manager complete.
[Oracle @ edbjr2p1 admin] $
Then, create the controlfile of the slave database in the master database.
SYS @ ORCL> alter database create standby controlfile as '/home/oracle/control. ctl ';
Database altered.
Transfer control files to the standby Database Host
[Oracle @ edbjr2p1 admin] $ scp/home/oracle/control. ctl edbjr2p2: $ ORACLE_BASE/oradata/AUX1/control01.ctl
Oracle @ edbjr2p2's password:
Control. ctl 100% 6896KB 6.7 MB/s
[Oracle @ edbjr2p1 admin] $ scp/home/oracle/control. ctl edbjr2p2: $ ORACLE_BASE/oradata/AUX1/control02.ctl
Oracle @ edbjr2p2's password:
Control. ctl 100% 6896KB 6.7 MB/s
[Oracle @ edbjr2p1 admin] $ scp/home/oracle/control. ctl edbjr2p2: $ ORACLE_BASE/oradata/AUX1/control03.ctl
Oracle @ edbjr2p2's password:
Control. ctl 100% 6896KB 6.7 MB/s
[Oracle @ edbjr2p1 admin] $
Transfers rman backup files to the same location on the standby Database Host
[Oracle @ edbjr2p1 dbs] $ scp 01osspjr_1_1 edbjr2p2: $ ORACLE_HOME/dbs/01osspjr_1_1
Oracle @ edbjr2p2's password:
01osspjr_1_1 100% 656 MB 5.7 MB/s
[Oracle @ edbjr2p1 dbs] $ scp 02ossplt_1_1 edbjr2p2: $ ORACLE_HOME/dbs/02ossplt_1_1
Oracle @ edbjr2p2's password:
02ossplt_1_1 100% 6976KB 6.8 MB/s
[Oracle @ edbjr2p1 dbs] $
6. start restoring files in the slave Database
[Oracle @ edbjr2p2 dbs] $ export ORACLE_SID = AUX1
[Oracle @ edbjr2p2 dbs] $ sqlplus/as sysdba
SQL * Plus: Release 10.2.0.1.0-Production on Tue Dec 31 10:09:23 2013
Copyright (c) 1982,200 5, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218968 bytes
Variable Size 88082024 bytes
Database Buffers 188743680 bytes
Redo Buffers 7168000 bytes
SQL> alter database mount standby database;
Database altered.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
With the Partitioning, OLAP and Data Mining options
[Oracle @ edbjr2p2 dbs] $ rman target/
Recovery Manager: Release 10.2.0.1.0-Production on Tue Dec 31 10:12:20 2013
Copyright (c) 1982,200 5, Oracle. All rights reserved.
Connected to target database: ORCL (DBID = 1363387608, not open)
RMAN> restore database
2>;
Starting restore at 31-DEC-13
Using target database control file instead of recovery catalog
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: sid = 151 devtype = DISK
Channel ORA_DISK_1: starting datafile backupset restore
Channel ORA_DISK_1: specifying datafile (s) to restore from backup set
Restoring datafile 00001 to/u01/app/oracle/oradata/AUX1/system01.dbf
Restoring datafile 00002 to/u01/app/oracle/oradata/AUX1/undotbs01.dbf
Restoring datafile 00003 to/u01/app/oracle/oradata/AUX1/sysaux01.dbf
Restoring datafile 00004 to/u01/app/oracle/oradata/AUX1/users01.dbf
Channel ORA_DISK_1: reading from backup piece/u01/app/oracle/product/10.2.0/db_1/dbs/01osspjr_1_1
Channel ORA_DISK_1: restored backup piece 1
Piece handle =/u01/app/oracle/product/10.2.0/db_1/dbs/01osspjr_1_1 tag = TAG20131231T095715
Channel ORA_DISK_1: restore complete, elapsed time: 00:01:07
Finished restore at 31-DEC-13
RMAN> exit;
Recovery Manager complete.
[Oracle @ edbjr2p2 dbs] $ sqlplus/as sysdba
SQL * Plus: Release 10.2.0.1.0-Production on Tue Dec 31 10:14:25 2013
Copyright (c) 1982,200 5, Oracle. All rights reserved.
Connected:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
With the Partitioning, OLAP and Data Mining options
SQL> alter database recover managed standby database disconnect from session;
Database altered.
Both the master and slave databases execute alter system register to ensure that the database has been registered with the listener.
Now configure OK
6. Test
Run the test now. Open the master database, create a tablespace in the master database, and check whether the tablespace is created in the alert log of the slave database.
Master database:
SYS @ ORCL> create tablespace test
2 datafile '/u01/app/oracle/oradata/ORCL/test01.dbf' size 5 m;
Tablespace created.
SYS @ ORCL> alter system archive log current;
System altered.
SYS @ ORCL>
View alert logs in the slave Database
[Oracle @ edbjr2p2 ~] $ Cd $ ORACLE_HOME/dbs
[Oracle @ edbjr2p2 dbs] $ ls
InitAUX1.ora initdw. ora init. ora orapwAUX1
[Oracle @ edbjr2p2 dbs] $ cd/u01/app/oracle/admin/AUX1/bdump/
[Oracle @ edbjr2p2 bdump] $ ls
Alert_AUX1.log auxw.arc2_14480.trc aux?mrp0_14551.trc
Aux1_arc0_14476.trc aux1_arc3_14482.trc
Aux?arc=14478.trc aux=dbw0_12923.trc
[Oracle @ edbjr2p2 bdump] $ tail-100f alert_AUX1.log
If the following content is displayed, the configuration is successful.
Recovery created file/u01/app/oracle/oradata/AUX1/test01.dbf
Successfully added datafile 7 to media recovery
Datafile #7: '/u01/app/oracle/oradata/AUX1/test01.dbf'
Media Recovery Waiting for thread 1 sequence 30