[20140415]使用dgmgrl管理dataguard(1)

简介: [20140415]使用dgmgrl管理dataguard(1).txt 前一段时间在看Apress.Expert.Consolidation.in.Oracle.Database.12c.Nov.2013.pdf电子文档,发现使用dgmgrl可以很好的管理dataguard, 这好这篇电子文档讲解还比较详细,自己基本按照该文档的介绍,熟悉与学习dgmgrl的命令语法以及一些基本概念。

[20140415]使用dgmgrl管理dataguard(1).txt

前一段时间在看Apress.Expert.Consolidation.in.Oracle.Database.12c.Nov.2013.pdf电子文档,发现使用dgmgrl可以很好的管理dataguard,
这好这篇电子文档讲解还比较详细,自己基本按照该文档的介绍,熟悉与学习dgmgrl的命令语法以及一些基本概念。

首先dgmgrl 表示 Data Guard Manager Line Mode,个人感觉使用dgmgrl管理dataguard,主要是简单方便,而且该命令系统自带,自成文档,
很容易学习,比起使用sqlplus来更加简单一些。

$ dgmgrl
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production

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

Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> help

The following commands are available:

add            Adds a standby database to the broker configuration
connect        Connects to an Oracle database instance
convert        Converts a database from one type to another
create         Creates a broker configuration
disable        Disables a configuration, a database, or fast-start failover
edit           Edits a configuration, database, or instance
enable         Enables a configuration, a database, or fast-start failover
exit           Exits the program
failover       Changes a standby database to be the primary database
help           Displays description and syntax for a command
quit           Exits the program
reinstate      Changes a database marked for reinstatement into a viable standby
rem            Comment to be ignored by DGMGRL
remove         Removes a configuration, database, or instance
show           Displays information about a configuration, database, or instance
shutdown       Shuts down a currently running Oracle database instance
sql            Executes a SQL statement
start          Starts the fast-start failover observer
startup        Starts an Oracle database instance
stop           Stops the fast-start failover observer
switchover     Switches roles between a primary and standby database

Use "help " to see syntax for individual commands

DGMGRL> help create

Creates a broker configuration

Syntax:

  CREATE CONFIGURATION AS
    PRIMARY DATABASE IS
    CONNECT IDENTIFIER IS ;

--可以发现建立一个配置语法很简单。

--按照文档介绍,建立wallet,实际上这个步骤完全可以省掉。这样就是提示行不需输入口令,提高管理的安全性。
--我基本按照文档的介绍来安装wallet。

1.建立wallet:
$ mkdir -p tns_admin
$ cd tns_admin
$ orapki wallet create -wallet . -auto_login_local
or
$ mkstore -wrl . -create

--感觉这两个结果是一样的。建立两个文件。

$ ll
total 8
-rw-------  1 oracle11g oinstall 3589 2014-04-04 11:50:13 cwallet.sso
-rw-------  1 oracle11g oinstall 3512 2014-04-04 11:50:13 ewallet.p12

2.配置tnsnames.ora:
$ cat tnsnames.ora
TEST =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.XXX.40)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = test.com)
    )
  )
--测试通过!


3.将连接信息添加到客户端的wallet里:

$ mkstore -wrl /home/oracle11g/tns_admin -createCredential test sys XXXXX
Oracle Secret Store Tool : Version 11.2.0.3.0 - Production
Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.

Enter wallet password:
Create credential oracle.security.client.connect_string1

4、配置客户端的sqlnet.ora,添加如下内容:

WALLET_LOCATION =
  (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
      (DIRECTORY = /home/oracle11g/tns_admin )
    )
  )

SQLNET.WALLET_OVERRIDE=true

5.测试看看是否成功:
$ sqlplus /@test as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 15 12:09:06 2014
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SYS@test> show user
USER is "SYS"
SYS@test>

6.修改.bash_profile文件,加入如下别名:
alias dgmgrl='/usr/local/bin/rlwrap -s 9999 -r -i  -f /home/oracle11g/dgmgrl.txt dgmgrl /@test'
--这样可以很好使用上下方向键。

7.补充dgmgrl.txt的建立方法:
$  dgmgrl /@test | tee /tmp/dgmgrl.txt
help
help add         
help connect     
help convert     
help create      
help disable     
help edit        
help enable      
help exit        
help failover    
help help        
help quit        
help reinstate   
help rem         
help remove      
help show        
help shutdown    
help sql         
help start       
help startup     
help stop        
help switchover  

--然后quit,整理编辑/tmp/dgmgrl.txt文件生成/home/oracle11g/dgmgrl.txt文件就ok了。内容如下:

add apply as auto
condition configuration connect convert create
database destinations disable
edit enable exit
failover fast_start force
help
identifier immediate instance is
logical
maintained maxavailability maxperformance maxprotection mode mount
nomount normal
observer off on only open
pfile physical preserve primary property protection
quit
read reinstate rem remove rename restrict
set show shutdown snapshot sql standby start startup state stop switchover
to
verbose
with write

目录
相关文章
|
Oracle 网络协议 关系型数据库
|
数据库 Go 测试技术
[20151109]使用dgmgrl管理dataguard(15)
[20151109]使用dgmgrl管理dataguard(15).txt 参考链接: http://blog.itpub.net/267265/viewspace-1142649/ http://blog.
1031 0
|
SQL 监控 Oracle
11g dataguard使用总结
11g的dataguard相比于10g来说,最优越的特性应该算就是active dataguard了,这一点改进在很大意义上促使用户需要把数据库从10g升级到11g,读写分离在这个时候得到了升华,而且在后台会根据需要进行数据的同步,相比于使用10g,想读数据的时候把数据库启动到read only 阶段,但这个时候不接受日志同步数据,如果需要同步数据还需要把数据库再启动到mount阶段,感觉还是比较繁琐的。
1212 0
dataguard dubugs
alter database open read only;alter database open read only*ERROR at line 1:ORA-10456: cannot open standby database; media recovery session may be in...
709 0
|
SQL Oracle 关系型数据库
[20140422]使用dgmgrl管理dataguard(14)
[20140422]使用dgmgrl管理dataguard(14).txt 参考链接: http://blog.itpub.net/267265/viewspace-1142649/ http://blog.
847 0
|
Oracle 关系型数据库 数据库
[20140422]使用dgmgrl管理dataguard(12)
[20140422]使用dgmgrl管理dataguard(12).txt 参考链接: http://blog.itpub.net/267265/viewspace-1142649/ http://blog.
927 0
|
SQL Oracle 关系型数据库
[20140422]使用dgmgrl管理dataguard(13)
[20140422]使用dgmgrl管理dataguard(13).txt 参考链接: http://blog.itpub.net/267265/viewspace-1142649/ http://blog.
980 0
|
测试技术 数据库 关系型数据库
[20140422]使用dgmgrl管理dataguard(11)
[20140422]使用dgmgrl管理dataguard(11).txt 参考链接: http://blog.itpub.net/267265/viewspace-1142649/ http://blog.
897 0
|
Oracle 关系型数据库 测试技术
[20140420]使用dgmgrl管理dataguard(10)
[20140420]使用dgmgrl管理dataguard(10).txt 参考链接: http://blog.itpub.net/267265/viewspace-1142649/ http://blog.
748 0