Oracle DataGuard 11g Dual-machine experiment

Source: Internet
Author: User

| operating System | Release 6.7 | Release 6.7 |

| host name | STUAAPP01 | STUAAPP02 |
| ip|192.168.20.234|192.168.20.235 |
Database software version |oracle 11.2.0.4.0|oracle 11.2.0.4.0 |
| oracle_base|/u01/app/oracle/|/u01/app/oracle/|
| oracle_home| $ORACLE _base/product/11.2.0/db_1| $ORACLE _base/product/11.2.0/db_1 |
| ORACLE_SID|ORCL | |
| Flash back Zone |4G | |
| archive | open | |
---------------------------------------------------------------------------------------------
View Database version
Sql> select * from V$version;
I. Primary database configuration and related operations
1. Confirm that the primary library is in archive mode
2. Place the primary library in force LOGGING mode
3. Add Standby Log file
4. Create a primary library client initialization parameter file
1). Create a pfile in the main library
2). Back up to the backup directory to create a pfile for the standby library
3). Modify the contents of the Pfile library as follows
4). Rebuilding SPFile by Pfile
5). Modify the Listening configuration file
6). Configure the Tnsnames.ora file
7). Start the database, test
5.rman backup database, in the Flash back zone
Two. Standby database configuration and related operations
1. Create the desired directory (note the OMF-managed files)
2. Copy the data file to the directory corresponding to the standby library
1). Copy the flash back area content
2). copy parameter file
3). Copy the password file
4). Copy monitoring files and TNS files
3. Modify the appropriate configuration
1). Modify the Listening configuration file
2). Modify the TNS configuration file
3). Restart the Monitoring service
4). The initialization parameters of the standby are as follows
5). Create SPFile from the Pfile
4. Recovering a Database
5. Start the Redo application
6. Verification
7. Switch to read-only mode
8. Switch to sync mode (no need to stop the library)

I. Primary database configuration and related operations
1. Confirm that the primary library is in archive mode
sql> archive log list;
Database Log Mode Archive mode
Automatic Archival Enabled
Archive Destination Use_db_recovery_file_dest
Oldest online log sequence 2
Next Log sequence to archive 4
Current Log Sequence 4

2. Place the primary library in force LOGGING mode
sql> ALTER DATABASE force logging;

Sql> select force_logging from V$database;

For
---
YES

Database altered.

3. Add Standby Log file
ALTER DATABASE ADD standby logfile Group 4 ('/u01/app/oracle/oradata/orcl/redo04.log ') size 50m;
ALTER DATABASE ADD standby logfile Group 5 ('/u01/app/oracle/oradata/orcl/redo05.log ') size 50m;
ALTER DATABASE ADD standby logfile Group 6 ('/u01/app/oracle/oradata/orcl/redo06.log ') size 50m;
ALTER DATABASE ADD standby logfile Group 7 ('/u01/app/oracle/oradata/orcl/redo07.log ') size 50m;


4. Create a primary library client initialization parameter file
1). Create a pfile in the main library
Sql> create Pfile from SPFile;

File created.

2). Back up to the backup directory to create a pfile for the standby library
[Email protected] dbs]$ pwd
/u01/app/oracle/product/11.2.0/db_1/dbs
[email protected] dbs]$ CP./initorcl.ora/home/oracle/backup/

3). Modify the contents of the Pfile library as follows
orcl.__db_cache_size=327155712
orcl.__java_pool_size=4194304
orcl.__large_pool_size=8388608
Orcl.__oracle_base= '/u01/app/oracle '
#ORACLE_BASE Set from environment
orcl.__pga_aggregate_target=318767104
orcl.__sga_target=469762048
Orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=121634816
Orcl.__streams_pool_size=0
*.audit_file_dest= '/u01/app/oracle/admin/orcl/adump '
*.audit_trail= ' DB '
*.compatible= ' 11.2.0.4.0 '
*.control_files= '/u01/app/oracle/oradata/orcl/control01.ctl ', '/u01/app/oracle/fast_recovery_area/orcl/ Control02.ctl '
*.db_block_size=8192
*.db_domain= "
*.db_name= ' ORCL '
*.db_recovery_file_dest= '/u01/app/oracle/fast_recovery_area '
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest= '/u01/app/oracle '
*.dispatchers= ' (protocol=tcp) (SERVICE=ORCLXDB) '
*.log_archive_format= '%t_%s_%r.dbf '
*.memory_target=786432000
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile= ' EXCLUSIVE '
*.undo_tablespace= ' UNDOTBS1 '
#################################################################
#Parameters for Primary Database.
#################################################################
*. Db_name= ' ORCL '
*. Db_unique_name=orcl
*. Log_archive_format=log%t_%s_%r.arc
*. Log_archive_config= ' dg_config= (ORCL,ORCLDG) '
*. Log_archive_dest_1= ' Location=/u01/app/oracle/archivelog valid_for= (all_logfiles,all_roles) DB_UNIQUE_NAME=ORCL '
*. Log_archive_dest_2= ' Service=orcldg lgwr ASYNC valid_for= (online_logfiles,primary_role) DB_UNIQUE_NAME=orcldg '
*. Log_archive_dest_state_1=enable
*. Log_archive_dest_state_2=enable
*. Remote_login_passwordfile=exclusive
*.standby_file_management=auto

#################################################################
#Parameters which using for switch over from Primary to Standby.
#################################################################
*. FAL_SERVER=ORCLDG
*. FAL_CLIENT=ORCL
*. Db_file_name_convert= '/u01/app/oracle/oradata/orcldg ', '/U01/APP/ORACLE/ORADATA/ORCL '
*.log_file_name_ Convert= '/u01/app/oracle/oradata/orcldg ', '/U01/APP/ORACLE/ORADATA/ORCL '
*.standby_archive_dest= '/u01/app/ Oracle/archive_log '

4). Through pfile reconstruction SPFile
sql> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

sql> Create SPFile from pfile= ' Initorcl.ora ';

File created.

5). Modify the Listening Profile
# Listener.ora Network configuration file:/u01/app/oracle/product/11.2.0/db_1/network/admin /listener.ora
# Generated by Oracle configuration tools.

LISTENER =
(Description_list =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.20.241) (PORT = 1521))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))
)
)

Adr_base_listener =/u01/app/oracle
6). Configure the Tnsnames.ora file
[Email protected] admin]$ pwd
/u01/app/oracle/product/11.2.0/db_1/network/admin
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.20.234) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = ORCL)
)
)

ORCLDG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.20.235) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = ORCLDG)
)
)

Extproc_connection_data =
(DESCRIPTION =
(Address_list =
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC0))
)
(Connect_data =
(SID = Plsextproc)
(PRESENTATION = RO)
)
)
7). Start the database, test
[Email protected] admin]$ tnsping ORCL

TNS Ping Utility for linux:version 11.2.0.4.0-production on 17-nov-2016 19:22:52

Copyright (c) 1997, Oracle. All rights reserved.

Used parameter files:


Used TNSNames Adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.50.241) (PORT = 1521)) (Connect_data = (SER VER = dedicated) (service_name = ORCL)))
OK (0 msec)

ALTER DATABASE set standby database to maximize availability;
5.rman backup database, in the Flash back zone
Backup Database plus archivelog;
Backup current controlfile for standby;

Two. Standby database configuration and related operations

1. Create the desired directory (note the OMF-managed file)
Show parameter dest
Mkdir-p/u01/app/oracle/admin/orcl/ Adump
mkdir-p/u01/app/oracle/admin/orcl/dpdump
mkdir-p/u01/app/oracle/diag/rdbms/orcl/orcldg/trace
Mkdir-p/u01/app/oracle/diag/rdbms/orcl/orcldg/cdump
mkdir-p/u01/app/oracle/flash_recovery_area
Mkdir-p/ U01/app/oracle/archivelog
mkdir-p/u01/app/oracle/archive_log
Mkdir-p/u01/app/oracle/fast_recovery_area

2. Copy the data file to the directory corresponding to the standby library
Copying files from the primary database server
1). Copy the flash back area content
Scp-r./* 192.168.20.235:/u01/app/oracle/fast_recovery_area/

2). copy parameter file
SCP./* 192.168.20.235:/u01/app/oracle/product/11.2.0/dbhome_1/dbs

3). Copy the password file
[Email protected] dbs]$ SCP ORAPWORCL 192.168.20.235:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/

4). Copy monitoring files and TNS files
SCP *.ora 192.168.20.235:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/

3. Modify the appropriate configuration

1). Modify the Listening configuration file
[Email protected] admin]$ VI Listener.ora

# Listener.ora Network Configuration File:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
(Description_list =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.20.235) (PORT = 1521))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))
)
)

Adr_base_listener =/u01/app/oracle

2). Modify the TNS configuration file


3). Restart the Monitoring service
Lsnrctl stop
Lsnrctl start

4). The initialization parameters of the standby are as follows
orcl.__db_cache_size=327155712
orcl.__java_pool_size=4194304
orcl.__large_pool_size=8388608
Orcl.__oracle_base= '/u01/app/oracle '
#ORACLE_BASE Set from environment
orcl.__pga_aggregate_target=318767104
orcl.__sga_target=469762048
Orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=121634816
Orcl.__streams_pool_size=0
*.audit_file_dest= '/u01/app/oracle/admin/orcl/adump '
*.audit_trail= ' DB '
*.compatible= ' 11.2.0.4.0 '
*.control_files= '/u01/app/oracle/oradata/orcl/control01.ctl ', '/u01/app/oracle/fast_recovery_area/orcl/ Control02.ctl '
*.db_block_size=8192
*.db_domain= "
*.db_name= ' ORCL '
*.db_recovery_file_dest= '/u01/app/oracle/fast_recovery_area '
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest= '/u01/app/oracle '
*.dispatchers= ' (protocol=tcp) (SERVICE=ORCLXDB) '
*.log_archive_format= '%t_%s_%r.dbf '
*.memory_target=786432000
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile= ' EXCLUSIVE '
*.undo_tablespace= ' UNDOTBS1 '
#################################################################
#Parameters for Standby Database.
#################################################################
*. Db_name= ' ORCL '
*. Db_unique_name=orcldg
*. Log_archive_format=log%t_%s_%r.arc
*. Log_archive_config= ' dg_config= (ORCL,ORCLDG) '
*. Db_file_name_convert= '/u01/app/oracle/oradata/orcl ', '/U01/APP/ORACLE/ORADATA/ORCLDG '
*. Log_file_name_convert= '/u01/app/oracle/oradata/orcl ', '/U01/APP/ORACLE/ORADATA/ORCLDG '
*. Standby_archive_dest= '/u01/app/oracle/archive_log '
*. Fal_server=orcl
*. Fal_client=orcldg
*. Standby_file_management=auto

#################################################################
#Parameters which using for switch over from Standby to Primary.
#################################################################
*. Log_archive_dest_1= ' Location=/u01/app/oracle/archivelog valid_for= (all_logfiles,all_roles) DB_UNIQUE_NAME=orcldg ‘
*. Log_archive_dest_2= ' Service=orcl lgwr ASYNC valid_for= (online_logfiles,primary_role) DB_UNIQUE_NAME=ORCL '
*. Log_archive_dest_state_1=enable
*. Log_archive_dest_state_2=enable
*. Remote_login_passwordfile=exclusive

5). Create SPFile from the Pfile
Sql> create SPFile from pfile= ' Initorcldg.ora ';

File created.
4 Recovering a database
Start Standby to Nomount
Startup Nomount
[[email protected] admin]$ Rman target Sys/[email protected] Auxiliary/
Rman> duplicate target database for standby nofilenamecheck;
Rman> exit
Close the database
Shutdown immediate




5. Start the Redo application
Startup Nomount;
ALTER DATABASE mount standby database;

sql> ALTER DATABASE recover managed standby database using current logfile disconnect from session;

Database altered.

6. Verification
Main Library
Sql> Archive Log List
Database Log Mode Archive mode
Automatic Archival Enabled
Archive Destination/u01/app/oracle/archivelog
Oldest online log sequence 73
Next log sequence to archive 75
Current log Sequence 75
Standby Library
Sql> Archive Log List
Database Log Mode Archive mode
Automatic Archival Enabled
Archive Destination/u01/app/oracle/archivelog
Oldest online log sequence 70
Next log sequence to archive 0
Current log Sequence 75
7. Switch to read-only mode
sql> ALTER DATABASE recover managed standby database cancel;

Database altered.
Sql> ALTER DATABASE open read only;

Database altered.
8. Switch to sync mode (no need to stop the library)
sql> ALTER DATABASE recover managed standby database using current logfile disconnect from session;

Database altered.

Oracle DataGuard 11g Dual-machine experiment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.