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

Use DGMGRL to manage Data Guard

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Data Guard ManaGeR command-Line interface[@more@]

1. Environment: Primary Database: ning

Physical Standby Database: test

2. Modify initialization parameter dg_broker_start

SQL> alter system set dg_broker_start=true;

3. Verify that the database is started using spfile

4. Start DGMGRL

C:>dgmgrl

DGMGRL for 32-bit Windows: Version 10.2.0.1.0 - Production

Copyright (c) 2000, 2005, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.

5. Connect to Primary Library DGMGRL> connect

Username: sys@ning

Password:

Connected.

6. create a configuration

DGMGRL> create configuration 'DGTEST' as

> primary database is 'ning'

> connect identifier is ning;

Configuration "DGTEST" created with primary database "ning"

7. Add alternate library

DGMGRL> add database 'test'

> as connect identifier is test

> maintained as physical;

Database "test" added

8. View configuration DGMGRL> show configuration

Configuration

Name: DGTEST

Enabled: NO

Protection Mode: MaxPerformance

Fast-Start Failover: DISABLED

Databases:

ning - Primary database

test - Physical standby database

Current status for "DGTEST": DISABLED

9. Set database properties

DGMGRL>edit database 'ning' set property 'LogArchiveFormat' = 'log_%t_%s_%r_%d.arc';

Property "LogArchiveFormat" updated

10. Display database properties

DGMGRL> show database verbose 'ning'

Database

Name: ning

Role: PRIMARY

Enabled: NO

Intended State: OFFLINE

Instance(s):

ning

Properties:

InitialConnectIdentifier = 'ning'

LogXptMode = 'ARCH'

Dependency = ''

DelayMins = '0'

Binding = 'OPTIONAL'

MaxFailure = '0'

MaxConnections = '1'

ReopenSecs = '300'

NetTimeout = '180'

LogShipping = 'ON'

PreferredApplyInstance = ''

ApplyInstanceTimeout = '0'

ApplyParallel = 'AUTO'

StandbyFileManagement = 'MANUAL'

ArchiveLagTarget = '0'

LogArchiveMaxProcesses = '2'

LogArchiveMinSucceedDest = '1'

DbFileNameConvert = ''

LogFileNameConvert = ''

FastStartFailoverTarget = ''

StatusReport = '(monitor)'

InconsistentProperties = '(monitor)'

InconsistentLogXptProps = '(monitor)'

SendQEntries = '(monitor)'

LogXptStatus = '(monitor)'

RecvQEntries = '(monitor)'

HostName = 'dgmis'

SidName = 'ning'

LocalListenerAddress = '(ADDRESS=(PROTOCOL=tcp)(HOST=dgmis)(PORT=

1521))'

StandbyArchiveLocation = 'e:oraclearch3ning'

AlternateLocation = ''

LogArchiveTrace = '0'

LogArchiveFormat = 'log_%t_%s_%r_%d.arc'

LatestLog = '(monitor)'

TopWaitEvents = '(monitor)'

Current status for "ning":

DISABLED

11. enable configuration

DGMGRL> enable configuration

Enabled.

DGMGRL> enable database 'ning'

Enabled.

DGMGRL> enable database 'test'

Enabled.

12. Check database status

DGMGRL> show database 'ning'

Database

Name: ning

Role: PRIMARY

Enabled: YES

Intended State: ONLINE

Instance(s):

ning

Current status for "ning":

SUCCESS

DGMGRL> show database 'test'

Database

Name: test

Role: PHYSICAL STANDBY

Enabled: YES

Intended State: ONLINE

Instance(s):

test

Current status for "test":

SUCCESS

DGMGRL> show configuration

Configuration

Name: DGTEST

Enabled: YES

Protection Mode: MaxPerformance

Fast-Start Failover: DISABLED

Databases:

ning - Primary database

test - Physical standby database

Current status for "DGTEST":

SUCCESS

13. Modify Data Guard's protection mode

DGMGRL> edit configuration set protection mode as maxperformance;

Succeeded.

14. Change standby library to read-only state

DGMGRL> edit database test set state='read-only';

Succeeded.

15. Stop log transfer from master to slave DGMGRL> edit database ning set state='log-transport-off';

Succeeded.

16. Take the master library offline

DGMGRL> edit database ning set state='offline';

Operation requires shutdown of instance "ning" on database "ning"

Shutting down instance "ning"...

Database closed.

Database dismounted.

ORACLE instance shut down.

Note: To bring the master database back online, you need to manually start the database first, and then

DGMGRL> connect sys@ning

Password:

Connected.

DGMGRL> edit database ning set state='online';

Succeeded.

17. disable configuration

DGMGRL> disable configuration

Disabled.

18. Disable a backup database DGMGRL> disable database 'test';

Disabled.

19. Remove standby library from configuration

DGMGRL> remove database 'test'

Removed database "test" from the configuration

20. delete configuration

DGMGRL> remove configuration

Removed configuration.

21. Perform Switchover

DGMGRL> switchover to 'test';

Performing switchover NOW, please wait...

Operation requires shutdown of instance "ning" on database "ning"

Shutting down instance "ning"...

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

Operation requires shutdown of instance "test" on database "test"

Shutting down instance "test"...

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

Operation requires startup of instance "ning" on database "ning"

Starting instance "ning"...

ORACLE instance started.

Database mounted.

Operation requires startup of instance "test" on database "test"

ORACLE instance started.

Database mounted

Switchover succeeded. New primary is "test"

DGMGRL> show configuration

Configuration

Name: DGTEST

Enabled: YES

Protection Mode: MaxPerformance

Fast-Start Failover: DISABLED

Databases:

ning - Physical standby database

test - Primary database

Current status for "DGTEST":

SUCCESS

22. Perform failover

DGMGRL> FAILOVER TO "test";

23. Generate database status reports (if you encounter Ora-16810)

DGMGRL> show database 'ning' 'statusreport'

STATUS REPORT

INSTANCE_NAME SEVERITY ERROR_TEXT

Appendix:

ORA-16525: the Data Guard broker is not yet available Check if the database initialization parameter dg_broker_start is true

ORA-16797: database is not using a server parameter file Please check that the database is started with spfile

ORA-16792: configuration property value is inconsistent with database setting

Check whether some attributes of the database are consistent with the initialization parameter settings of the data, such as LogArchiveFormat attribute and log_archive_format parameter.

ORA-16505: site ID is invalid

Check if the database is enabled

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

Internet Technology

Wechat

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

12
Report