Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle builds dataguard on a machine

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

In the past two days, I found a machine to build dataguard.

1. Prepare for the environment.

Operating system

[oracle] $lsb_release-a

LSB Version:: base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch

Distributor ID: RedHatEnterpriseServer

Description: Red Hat Enterprise Linux Server release 6.8 (Santiago)

Release: 6.8

Codename: Santiago

Database version

SQL > select instance_name,version from v$instance

INSTANCE_NAME VERSION

--

Dgtest1 11.2.0.4.0

Create a new database with instance dgtest1 on the machine.

two。 Keep a mandatory log on the main library.

Alter database force logging

3. Create a password file for the standby database, because it is on a machine, you can directly use the password file copy of the main library.

[oracle@bdev dbs] $ls-l orapwdg*

-rw-r- 1 oracle oinstall 1536 Oct 18 17:08 orapwdgtest1

-rw-r- 1 oracle oinstall 1536 Oct 19 13:51 orapwdgtest2

4. Create a pfile in the main library.

Create pfile='/home/oracle/pfiledgtest1.ora' from spfile

5. Edit the pfiledgtest.ora file.

[oracle ~] $more pfiledgtest1.ora

Dgtest1.__db_cache_size=3338665984

Dgtest1.__java_pool_size=67108864

Dgtest1.__large_pool_size=83886080

Dgtest1.__oracle_base='/ulic/app/oracle'#ORACLE_BASE set from environment

Dgtest1.__pga_aggregate_target=2147483648

Dgtest1.__sga_target=4294967296

Dgtest1.__shared_io_pool_size=0

Dgtest1.__shared_pool_size=771751936

Dgtest1.__streams_pool_size=0

* .audit_file_dest='/ulic/app/oracle/admin/dgtest1/adump'

* .audit_trail='db'

* .compatible='11.2.0.4.0'

* .control_files='/ulic/oradata/dgtest1/control01.ctl','/ulic/app/oracle/fast_recovery_area/dgtest1/control02.ctl'

* .db_block_size=8192

* .db_domain=''

* .db_name='dgtest1'

* .db_recovery_file_dest='/ulic/app/oracle/fast_recovery_area'

* .db_recovery_file_dest_size=4385144832

* .diagnostic_dest='/ulic/app/oracle'

* .dispatchers=' (PROTOCOL=TCP) (SERVICE=dgtest1XDB)'

* .log_archive_format='%t_%s_%r.arc'

* .open_cursors=300

* .pga_aggregate_target=2147483648

* .processes=150

* .remote_login_passwordfile='EXCLUSIVE'

* .sga_target=4294967296

* .undo_tablespace='UNDOTBS1'

# what needs to be added

DB_NAME=dgtest1

DB_UNIQUE_NAME=dgtest1

LOG_ARCHIVE_CONFIG='DG_CONFIG= (dgtest1,dgtest2)'

LOG_ARCHIVE_DEST_1=

'LOCATION=/ulic/archivelog/dgtest1/

VALID_FOR= (ALL_LOGFILES,ALL_ROLES)

DB_UNIQUE_NAME=dgtest1'

LOG_ARCHIVE_DEST_2=

'SERVICE=dgtest2 ARCH ASYNC NOAFFIRM

VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE)

DB_UNIQUE_NAME=dgtest2'

LOG_ARCHIVE_DEST_STATE_1=ENABLE

LOG_ARCHIVE_DEST_STATE_2=ENABLE

[oracle~] $

6. After the modification is completed, the main library will be up.

SQL > startup pfile='/home/oracle/pfiledgtest1.ora'

ORACLE instance started.

Total System Global Area 4275781632 bytes

Fixed Size 2260088 bytes

Variable Size 939525000 bytes

Database Buffers 3321888768 bytes

Redo Buffers 12107776 bytes

Database mounted.

Database opened.

SQL >

7. Make sure that after modifying the pfile, the database can still be normal and then give the database to the down. (this is used to make a cold backup for the database) the test environment, so it can be directly started and stopped.

8. Create a standby database and create a new dgtest2 directory under the oradata directory.

[oracle@oradata] $pwd

/ ulic/oradata

[oracle@bdev oradata] $ls-l

Total 8

Drwxr-x--- 2 oracle oinstall 4096 Oct 18 17:07 dgtest1

Drwxr-xr-x 2 oracle oinstall 4096 Oct 19 11:10 dgtest2

9. Copy the datafile and log from the dgtest1 directory to the dgtest2 directory.

[oracle@bdev dgtest2] $ls-l

Total 1561220

-rw-r- 1 oracle oinstall 52429312 Oct 19 13:53 redo01.log

-rw-r- 1 oracle oinstall 52429312 Oct 19 13:53 redo02.log

-rw-r- 1 oracle oinstall 52429312 Oct 19 13:53 redo03.log

-rw-r- 1 oracle oinstall 555753472 Oct 19 14:19 sysaux01.dbf

-rw-r- 1 oracle oinstall 775954432 Oct 19 14:19 system01.dbf

-rw-r- 1 oracle oinstall 30416896 Oct 19 11:05 temp01.dbf

-rw-r- 1 oracle oinstall 73408512 Oct 19 14:19 undotbs01.dbf

-rw-r- 1 oracle oinstall 5251072 Oct 19 14:19 users01.dbf

10. The main library is opened to generate standby control files, and copy to the dgtest2 directory, and copy two copies to control01.ctl, control02.ctl.

Alter database create standby controlfile as'/ ulic/oradata/dgtest2/control.std'

[oracle@dgtest2] $ls-l

Total 1561220

-rw-r- 1 oracle oinstall 9748480 Oct 19 15:48 control01.ctl

-rw-r- 1 oracle oinstall 9748480 Oct 19 15:48 control02.ctl

-rw-r- 1 oracle asmadmin 9748480 Oct 19 11:08 control.std

-rw-r- 1 oracle oinstall 52429312 Oct 19 13:53 redo01.log

-rw-r- 1 oracle oinstall 52429312 Oct 19 13:53 redo02.log

-rw-r- 1 oracle oinstall 52429312 Oct 19 13:53 redo03.log

-rw-r- 1 oracle oinstall 555753472 Oct 19 14:19 sysaux01.dbf

-rw-r- 1 oracle oinstall 775954432 Oct 19 14:19 system01.dbf

-rw-r- 1 oracle oinstall 30416896 Oct 19 11:05 temp01.dbf

-rw-r- 1 oracle oinstall 73408512 Oct 19 14:19 undotbs01.dbf

-rw-r- 1 oracle oinstall 5251072 Oct 19 14:19 users01.dbf

11. Copy a copy of pfiledgtest1.ora to pfiledgtest2.ora and modify the content.

[oracle@~] $more pfiledgtest2.ora

Dgtest2.__db_cache_size=3338665984

Dgtest2.__java_pool_size=67108864

Dgtest2.__large_pool_size=83886080

Dgtest2.__oracle_base='/ulic/app/oracle'#ORACLE_BASE set from environment

Dgtest2.__pga_aggregate_target=2147483648

Dgtest2.__sga_target=4294967296

Dgtest2.__shared_io_pool_size=0

Dgtest2.__shared_pool_size=771751936

Dgtest2.__streams_pool_size=0

* .audit_file_dest='/ulic/app/oracle/admin/dgtest2/adump'

* .audit_trail='db'

* .compatible='11.2.0.4.0'

* .control_files='/ulic/oradata/dgtest2/control01.ctl','/ulic/oradata/dgtest2/control02.ctl'

* .db_block_size=8192

* .db_domain=''

* .db_recovery_file_dest='/ulic/app/oracle/fast_recovery_area'

* .db_recovery_file_dest_size=4385144832

* .diagnostic_dest='/ulic/app/oracle'

* .dispatchers=' (PROTOCOL=TCP) (SERVICE=dgtest2XDB)'

* .log_archive_format='%t_%s_%r.arc'

* .open_cursors=300

* .pga_aggregate_target=2147483648

* .processes=150

* .remote_login_passwordfile='EXCLUSIVE'

* .sga_target=4294967296

* .undo_tablespace='UNDOTBS1'

DB_NAME=dgtest1

DB_UNIQUE_NAME=dgtest2

LOG_ARCHIVE_CONFIG='DG_CONFIG= (dgtest1,dgtest2)'

LOG_ARCHIVE_DEST_1=

'LOCATION=/ulic/archivelog/dgtest2/

VALID_FOR= (ALL_LOGFILES,ALL_ROLES)

DB_UNIQUE_NAME=dgtest2'

LOG_ARCHIVE_DEST_STATE_1=ENABLE

FAL_SERVER=dgtest1

FAL_CLIENT=dgtest2

DB_FILE_NAME_CONVERT='/ulic/oradata/dgtest1','/ulic/oradata/dgtest2'

LOG_FILE_NAME_CONVERT='/ulic/oradata/dgtest1','/ulic/oradata/dgtest2'

STANDBY_FILE_MANAGEMENT=AUTO

twelve。 Configure snooping.

DGTEST1 =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = bdev) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = dgtest1)

)

)

DGTEST2 =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = 10.18.1.123) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = dgtest2)

)

)

13. Start the standby library to the mount state.

SQL > startup mount pfile='/home/oracle/pfiledgtest2.ora'

ORACLE instance started.

Total System Global Area 4275781632 bytes

Fixed Size 2260088 bytes

Variable Size 939525000 bytes

Database Buffers 3321888768 bytes

Redo Buffers 12107776 bytes

Database mounted.

Check the slave identity SQL > select database_role from v$database

DATABASE_ROLE

-

PHYSICAL STANDBY

View the identity of the master library

SQL > select database_role from v$database

DATABASE_ROLE

-

PRIMARY

14. Start applying the log from the library to standby recover.

Alter database recover managed standby database disconnect from session

15. Switch the log to verify that it can be transferred properly.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report