Building oracle11G DG in linux (2): Building a master database

Source: Internet
Author: User

Building oracle11G DG in linux (2): Building a master database

Environment

Name

Master Database

Slave Database

Host Name

Bjsrv

Shsrv

Software Version

RedHat performanise5.5, Oracle 11g 11.2.0.1

RedHat performanise5.5, Oracle 11g 11.2.0.1



2. operations on the master database: 1. Modify the initialization parameters of the master database.

SQL>Show parameter spfile;

 

NAME TYPE VALUE

-----------------------------------------------------------------------------

Spfile string/u01/app/oracle/product/11.2.0

/Dbhome_1/dbs/spfileTestDB12.ora

 

SQL>Create pfile from spfile;

$Cd $ ORACLE_HOME/dbs/

$Vi initTestDB12.ora //Edit pfile

Find the online document and find the pfile format of DG:










Instructions for adding changes:

Settings in the original parameter file:

*. Audit_file_dest = '/u01/app/oracle/admin/TestDB12/adump'

*. Audit_trail = 'db'

*. Compatible = '11. 2.0.0.0'

*. Control_files = '/u01/app/oracle/oradata/TestDB12/control01.ctl', '/u01/app/oracle/fast_recovery_area/TestDB12/control02.ctl'

*. Db_block_size = 8192

*. Db_domain = 'cuug. net' // Delete

*. Db_name = 'testdb12'

*. Db_recovery_file_dest = '/u01/app/oracle/fast_recovery_area'

*. Db_recovery_file_dest_size = 4322230272

*. Diagnostic_dest = '/u01/app/oracle'

*. Dispatchers = '(PROTOCOL = TCP) (SERVICE = TestDB12XDB )'

*. Log_archive_dest_1 = 'location =/dsk4/arch_bj '// Delete

*. Log_archive_format = 'arch _ % t _ % s _ % r. Log'

*. Memory_target = 642006528

*. Open_cursors = 300

*. Processses = 150

*. Remote_login_passwordfile = 'clusive '// Add

*. Undo_tablespace = 'undotbs1' // Add

Parameter settings added in the document:

DB_NAME = chicago // Delete

DB_UNIQUE_NAME = bjdb // alias

LOG_ARCHIVE_CONFIG = 'dg _ CONFIG = (bjdb, shdb )'

// Alias of the Database Host involved in the DG

CONTROL_FILES = '/arch1/chicago/control1.ctl', '/arch2/chicago/control2.ctl' // Delete

 

LOG_ARCHIVE_DEST_1 =

'Location =/dsk4/arch_bj

VALID_FOR = (ALL_LOGFILES, ALL_ROLES)

DB_UNIQUE_NAME = bjdb' // enter the master database alias

 

LOG_ARCHIVE_DEST_2 =

'Service = shdb ASYNC // transmits data to the remote standby database over the network. maximum performance: asynchronous transmission

VALID_FOR = (ONLINE_LOGFILES, PRIMARY_ROLE)

// It takes effect only for the master database. Only the master database passes logs to the slave database.

DB_UNIQUE_NAME = shdb

'

LOG_ARCHIVE_DEST_STATE_1 = ENABLE // sets whether the archive location is available.

LOG_ARCHIVE_DEST_STATE_2 = ENABLE

 

REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE // Delete

LOG_ARCHIVE_FORMAT = % t _ % s _ % r. arc // Delete

 

LOG_ARCHIVE_MAX_PROCESSES = 3 // Add. Is this line not included in this document?

 

FAL_SERVER = shdb // write the service name of the other party

DB_FILE_NAME_CONVERT = '/u01/app/oracle/oradata/Sh','/u01/app/oracle/oradata/testdb12'

// File conversion to let the slave database know that the data of the master database has changed. First, write the data of the Peer database and then write the data of the primary database.

LOG_FILE_NAME_CONVERT =

'/Dsk1/oradata/Sh','/dsk1/oradata/bj ','/dsk2/oradata/Sh', '/dsk2/oradata/bj'

// If the redo log file changes, notify the slave database to write the logs to the slave database first, and then write the logs to the slave database. If there are multiple paths, the master and slave databases must correspond to each other one by one.

STANDBY_FILE_MANAGEMENT = AUTO // indicates automatic conversion

 

 

Modify parameters (example ):

*. Audit_file_dest = '/u01/app/oracle/admin/TestDB12/adump'

*. Audit_trail = 'db'

*. Compatible = '11. 2.0.0.0'

*. Control_files = '/u01/app/oracle/oradata/TestDB12/control01.ctl', '/u01/app/oracle/fast_recovery_area/TestDB12/control02.ctl'

*. Db_block_size = 8192

*. Db_name = 'testdb12'

*. Db_recovery_file_dest = '/u01/app/oracle/fast_recovery_area'

*. Db_recovery_file_dest_size = 4322230272

*. Diagnostic_dest = '/u01/app/oracle'

*. Dispatchers = '(PROTOCOL = TCP) (SERVICE = TestDB12XDB )'

*. Log_archive_format = 'arch _ % t _ % s _ % r. Log'

*. Memory_target = 642006528

*. Open_cursors = 300

*. Processses = 150

*. Remote_login_passwordfile = 'clusive'

*. Undo_tablespace = 'undotbs1'

DB_UNIQUE_NAME = bjdb

 

LOG_ARCHIVE_CONFIG = 'dg _ CONFIG = (bjdb, shdb )'

 

LOG_ARCHIVE_DEST_1 =

'Location =/dsk4/arch_bj

VALID_FOR = (ALL_LOGFILES, ALL_ROLES)

DB_UNIQUE_NAME = bjdb'

 

LOG_ARCHIVE_DEST_2 =

'Service = shdb ASYNC

VALID_FOR = (ONLINE_LOGFILES, PRIMARY_ROLE)

DB_UNIQUE_NAME = shdb'

 

LOG_ARCHIVE_DEST_STATE_1 = ENABLE

LOG_ARCHIVE_DEST_STATE_2 = ENABLE

 

LOG_ARCHIVE_MAX_PROCESSES = 3

 

FAL_SERVER = shdb

DB_FILE_NAME_CONVERT = '/u01/app/oracle/oradata/Sh','/u01/app/oracle/oradata/testdb12'

LOG_FILE_NAME_CONVERT =

'/Dsk1/oradata/Sh','/dsk1/oradata/bj ','/dsk2/oradata/Sh', '/dsk2/oradata/bj'

STANDBY_FILE_MANAGEMENT = AUTO

 

Start a database using pfile

SQL>Startupforce nomountpfile = '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initTestDB12.ora ';

 

Supplement:

SQL> startup force nomountpfile = '$ ORACLE_HOME/dbs/initTestdb12.ora ';

Error ORA-01078:




Check that the parameter name is incorrectly written and changed from initTestdb12.ora to initTestDB12.ora.

 

SQL>Showparameter archive





SQL>Create spfile frompfile;// Pfile generated by spfile

SQL>Startup forcemount;// Start to mount

2. Slave database-create a file directory

Create a directory (used to store data files and log files) in the standby database (sh ):

$Mkdir-p/u01/app/oracle/oradata/sh

$Mkdir-p/u01/app/oracle/admin/sh/adump// Stores the Audit Directory

3. master database-copy data files to the slave Database

Note:Make sure that the master database is in the mount state.

 

Method:

1. Manual copy;

2. RMAN backup;

3. RMAN clone.

 

$Scp/u01/app/oracle/oradata/TestDB12/*. dbfshsrv:/u01/app/oracle/oradata/sh

 

The authenticity of host 'shsrv (192.168.4.72) 'can't be established.

RSA key fingerprint is 0f: d8: 72: 64: 60: b4: 0e: b6: 72: 69: 68: 7d: aa: 7e: b8: bb.

Are you sure you want to continue connecting (yes/no )?Yes

Warning: Permanently added 'shsrv, 192.168.4.72 '(RSA) to the list of knownhosts.

Oracle @ shsrv's password: oracle




4. master database-Generate and copy control files for the slave Database

SQL>Selectstatus from v $ instance;

// When the master database is in the mount state, the control file can be generated for the slave database.




SQL>Alterdatabase create standby controlfile as '/home/oracle/sh_control01.ctlcle/sh_control01.ctl ';

// Place the production control file to the specified directory

$Scp/home/oracle/sh_control01.ctl shsrv:/u01/app/oracle/oradata/sh

// Copy the generated slave Database Control file to the slave database (sh) through the master database




5. master database-copy parameter files to slave Database

$Cd $ ORACLE_HOME/dbs

$ScpinitTestDB12.ora shsrv: $ ORACLE_HOME/dbs/initshdb. ora




6. master database-copy the password file to the slave Database

$Scp $ ORACLE_HOME/dbs/orapwTestDB12 shsrv: $ ORACLE_HOME/dbs/orapwshdb




7. master database-view alarm log files

$Tail-f/u01/app/oracle/diag/rdbms/bjdb/TestDB12/trace/alert_TestDB12.log




Crtl + z exit // determined by the CRT settings


****************** ********

Statement:
Original works, from "Deep Blue blog" blog, allow reprint, reprint please be sure to indicate the source (http://blog.csdn.net/huangyanlong ).

The author has the right to pursue legal liability for copyright issues.



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.