Bo's Oracle Station

【博客文章2023】跨库云计算:能管理Dataguard Broker的Oracle全局服务

2023-2-21 16:32| 发布者: admin| 查看: 67| 评论: 0

摘要: 【博客文章2023】跨库层面:能管理Dataguard Broker的Oracle全局服务管理。
【博客文章2023】跨库云计算:能管理Dataguard Broker的Oracle全局服务

Author: Bo Tang

1. MAA起始环境:

    实验的起始环境是:在主机station3.example.com和主机station4.example.com上运行着名为c01orcl.example.com的RAC数据库(版本12.2.0.1);在主机station5.example.com和主机station6.example.com上运行着名为c02orcl.example.com的RAC数据库(版本12.2.0.1)。c01orcl.example.com为主库,c02orcl.example.com为物理备库,dataguard状态正常

[oracle@station3 ~]$ dgmgrl 
DGMGRL for Linux: Release 12.2.0.1.0 - Production on Sat Feb 18 22:10:08 2023

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U@c01orcl
Connected to "c01orcl"
Connected as SYSDBA.
DGMGRL> show configuration verbose;

Configuration - dgconfig

  Protection Mode: MaxAvailability
  Members:
  c01orcl - Primary database
    c02orcl - Physical standby database 

  Properties:
    FastStartFailoverThreshold      = '10'
    OperationTimeout                = '30'
    TraceLevel                      = 'USER'
    FastStartFailoverLagLimit       = '30'
    CommunicationTimeout            = '180'
    ObserverReconnect               = '0'
    FastStartFailoverAutoReinstate  = 'TRUE'
    FastStartFailoverPmyShutdown    = 'TRUE'
    BystandersFollowRoleChange      = 'ALL'
    ObserverOverride                = 'FALSE'
    ExternalDestination1            = ''
    ExternalDestination2            = ''
    PrimaryLostWriteAction          = 'CONTINUE'
    ConfigurationWideServiceName    = ''

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

    解锁c01orcl.example.com数据库上的gsmuser用户,并设定密码。

2. 安装好GDS软件创建GDS CATALOG:

    在station3.example.com和station5.example.com这两台主机上分别安装好12.2.0.1版本的gds软件。软件安装在/u01/app/oracle/product/12.2.0/gsm_1目录下:

[oracle@station3 gsm_1]$ pwd
/u01/app/oracle/product/12.2.0/gsm_1
[oracle@station3 gsm_1]$ ls
assistants   css          env.ora        javavm  log      oraInst.loc  precomp   slax      wwg
bin          cv           has            jdbc    network  oss          QOpatch   sqlplus   xdk
cdata        dbjava       hs             jdk     nls      oui          racg      srvm
cfgtoollogs  deinstall    install        jlib    OPatch   owm          rdbms     suptools
clone        diagnostics  instantclient  ldap    opmn     perl         relnotes  ucp
crs          dmu          inventory      lib     oracore  plsql        root.sh   utl

[oracle@station5 gsm_1]$ pwd
/u01/app/oracle/product/12.2.0/gsm_1
[oracle@station3 gsm_1]$ ls
assistants   css          env.ora        javavm  log      oraInst.loc  precomp   slax      wwg
bin          cv           has            jdbc    network  oss          QOpatch   sqlplus   xdk
cdata        dbjava       hs             jdk     nls      oui          racg      srvm
cfgtoollogs  deinstall    install        jlib    OPatch   owm          rdbms     suptools
clone        diagnostics  instantclient  ldap    opmn     perl         relnotes  ucp
crs          dmu          inventory      lib     oracore  plsql        root.sh   utl

    在station3.example.com上准备好版本为12.2.0.1的另外一个数据库:gdscat.example.com,作为gds的catalog。解锁gdscat.example.com数据库上的gsmcatuser,并设置gsmcatuser的密码。在gdscat.example.com数据库上创建新用户mygdsadmin,并授予该新用户gsmadmin_role。mygdsadmin用户用于创建gdscatalog:

[oracle@station3 ~]$ cat /etc/oratab
c01orcl1:/u01/app/oracle/product/12.2.0/dbhome_1:N              # line added by Agent
c01orcl2:/u01/app/oracle/product/12.2.0/dbhome_1:N              # line added by Agent
-MGMTDB:/u01/app/12.2.0/grid:N
+ASM1:/u01/app/12.2.0/grid:N            # line added by Agent
gdscat:/u01/app/oracle/product/12.2.0/dbhome_1:N
gsm:/u01/app/oracle/product/12.2.0/gsm_1:N

[oracle@station3 ~]$ . oraenv
ORACLE_SID = [gsm] ? 
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@station3 ~]$ gdsctl
GDSCTL: Version 12.2.0.1.0 - Production on Mon Feb 20 08:24:37 CST 2023

Copyright (c) 2011, 2016, Oracle.  All rights reserved.

Welcome to GDSCTL, type "help" for information.

Current GSM is set to GSMORA
GDSCTL>create catalog -database station3:1521:gdscat -user mygdsadmin/oracle_4U

3. 在主库的第1个节点上创建GSM并启动GSM:

    在station3.example.com上,添加名为gsmc01orcl的gsm,并启动它:

[oracle@station3 ~]$ . oraenv
ORACLE_SID = [gsm] ? 
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@station3 ~]$ gdsctl
GDSCTL: Version 12.2.0.1.0 - Production on Mon Feb 20 08:34:47 CST 2023

Copyright (c) 2011, 2016, Oracle.  All rights reserved.

Welcome to GDSCTL, type "help" for information.

Current GSM is set to GSMORA
GDSCTL>connect mygdsadmin/oracle_4U@gdscat
GDSCTL>add gsm -gsm gsmc01orcl -listener 1571 -catalog station3:1521:gdscat

GDSCTL>start gsm -gsm gsmc01orcl 
GSM is started successfully

GDSCTL>add region -region regc01orcl, regc02orcl

GDSCTL>modify gsm -gsm gsmc01orcl -region regc01orcl

GDSCTL>config gsm -gsm gsmc01orcl
Name: gsmc01orcl
Endpoint 1: (ADDRESS=(HOST=station3.example.com)(PORT=1571)(PROTOCOL=tcp))
Local ONS port: 6123
Remote ONS port: 6234
ORACLE_HOME path: /u01/app/oracle/product/12.2.0/gsm_1
GSM Host name: station3.example.com
Region: regc01orcl


Buddy
------------------------

GDSCTL>status gsm -gsm gsmc01orcl
Alias                     GSMC01ORCL
Version                   12.2.0.1.0
Start Date                03-MAR-2023 23:24:36
Trace Level               off
Listener Log File         /u01/app/oracle/diag/gsm/station3/gsmc01orcl/alert/log.xml
Listener Trace File       /u01/app/oracle/diag/gsm/station3/gsmc01orcl/trace/ora_74589_139730373075264.trc
Endpoint summary          (ADDRESS=(HOST=station3.example.com)(PORT=1571)(PROTOCOL=tcp))
GSMOCI Version            2.2.1
Mastership                Y
Connected to GDS catalog  Y
Process Id                74592
Number of reconnections   0
Pending tasks.     Total  0
Tasks in  process. Total  0
Regional Mastership       TRUE
Total messages published  1658
Time Zone                 +08:00
Orphaned Buddy Regions:   
     None
GDS region                regc01orcl
Network metrics:
   Region: regc02orcl Network factor:0

    在上述过程中,在station3.example.com的/u01/app/oracle/product/12.2.0/gsm_1/network/admin目录下自动配置tnsnames.ora中蓝色部分:

GDSCAT =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = station3.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = gdscat.example.com)
    )
  )

LISTENER_GDSCAT =
  (ADDRESS = (PROTOCOL = TCP)(HOST = station3.example.com)(PORT = 1521))


GSMC01ORCL_CATALOG =
  (DESCRIPTION =
    (address = (protocol = tcp)(host = station3)(port = 1521))
    (CONNECT_DATA = 
      (SERVICE_NAME = GDS$CATALOG.oradbcloud)
    )
  )

C02ORCL2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = station6.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = c02orcl.example.com)
    )
  )

C02ORCL1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = station5.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = c02orcl.example.com)
    )
  )

C01ORCL2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = station4.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = c01orcl.example.com)
    )
  )

C01ORCL1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = station3.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = c01orcl.example.com)
    )
  )

C02ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = scan5.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = c02orcl.example.com)
    )
  )

C01ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = scan3.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = c01orcl.example.com)
    )
  )

GSMC01ORCL =
  (DESCRIPTION =
    (ADDRESS = (HOST = station3.example.com)(PORT = 1571)(PROTOCOL = tcp))
    (CONNECT_DATA =
      (SERVICE_NAME = GDS$CATALOG.oradbcloud)
    )
  )

    如果没有上述蓝色的TNS项目,启动gsm时会报如下的错误:

GSM-45054: GSM error
GSM-40070: GSM is not able to establish connection to GDS catalog 

    在station3.example.com的/u01/app/oracle/product/12.2.0/gsm_1/network/admin目录下自动配置gsm.ora:

# gsm.ora Network Configuration File: /u01/app/oracle/product/12.2.0/gsm_1/network/admin/gsm.ora
# Generated by Oracle configuration tools.

SQLNET.WALLET_OVERRIDE = TRUE

WALLET_LOCATION =
  (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
      (DIRECTORY = /u01/app/oracle/product/12.2.0/gsm_1/network/admin/gsmwallet)
    )
  )

GSMC01ORCL =
  (configuration =
    (listener =
      (ADDRESS = (HOST = station3.example.com)(PORT = 1571)(PROTOCOL = tcp))
    )
    (cloud = oradbcloud)
  )

4. 在备库的第1个节点上创建GSM并启动GSM:

    在station5.example.com上,添加名为gsmc02orcl的gsm,并启动它:

[oracle@station5 ~]$ . oraenv
ORACLE_SID = [gsm] ? 
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@station5 ~]$ gdsctl
GDSCTL: Version 12.2.0.1.0 - Production on Mon Feb 20 08:54:37 CST 2023

Copyright (c) 2011, 2016, Oracle.  All rights reserved.

Welcome to GDSCTL, type "help" for information.

Current GSM is set to GSMORA
GDSCTL>connect mygdsadmin/oracle_4U@gdscat
GDSCTL>add gsm -gsm gsmc02orcl -listener 1572 -catalog station3:1521:gdscat

GDSCTL>start gsm -gsm gsmc02orcl 
GSM is started successfully

GDSCTL>modify gsm -gsm gsmc02orcl -region regc02orcl

GDSCTL>config gsm -gsm gsmc02orcl
Name: gsmc02orcl
Endpoint 1: (ADDRESS=(HOST=station5.example.com)(PORT=1572)(PROTOCOL=tcp))
Local ONS port: 6123
Remote ONS port: 6234
ORACLE_HOME path: /u01/app/oracle/product/12.2.0/gsm_1
GSM Host name: station5.example.com
Region: regc02orcl


Buddy
------------------------

GDSCTL>status gsm -gsm gsmc02orcl
Alias                     GSMC02ORCL
Version                   12.2.0.1.0
Start Date                04-MAR-2023 00:48:44
Trace Level               off
Listener Log File         /u01/app/oracle/diag/gsm/station5/gsmc02orcl/alert/log.xml
Listener Trace File       /u01/app/oracle/diag/gsm/station5/gsmc02orcl/trace/ora_71594_139860764832064.trc
Endpoint summary          (ADDRESS=(HOST=station5.example.com)(PORT=1572)(PROTOCOL=tcp))
GSMOCI Version            2.2.1
Mastership                N
Connected to GDS catalog  Y
Process Id                71596
Number of reconnections   0
Pending tasks.     Total  0
Tasks in  process. Total  0
Regional Mastership       TRUE
Total messages published  1462
Time Zone                 +08:00
Orphaned Buddy Regions:   
     None
GDS region                regc02orcl
Network metrics:
   Region: regc01orcl Network factor:0

    在上述过程中,在station5.example.com的/u01/app/oracle/product/12.2.0/gsm_1/network/admin目录下自动配置tnsnames.ora中蓝色部分:

GDSCAT =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = station3.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = gdscat.example.com)
    )
  )

LISTENER_GDSCAT =
  (ADDRESS = (PROTOCOL = TCP)(HOST = station3.example.com)(PORT = 1521))


GSMC02ORCL_CATALOG =
  (DESCRIPTION =
    (address = (protocol = tcp)(host = station3)(port = 1521))
    (CONNECT_DATA =
      (SERVICE_NAME = GDS$CATALOG.oradbcloud)
    )
  )

C02ORCL2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = station6.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = c02orcl.example.com)
    )
  )

C02ORCL1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = station5.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = c02orcl.example.com)
    )
  )

C01ORCL2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = station4.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = c01orcl.example.com)
    )
  )

C01ORCL1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = station3.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = c01orcl.example.com)
    )
  )

C02ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = scan5.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = c02orcl.example.com)
    )
  )

C01ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = scan3.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = c01orcl.example.com)
    )
  )

GSMC02ORCL =
  (DESCRIPTION =
    (ADDRESS = (HOST = station5.example.com)(PORT = 1572)(PROTOCOL = tcp))
    (CONNECT_DATA =
      (SERVICE_NAME = GDS$CATALOG.oradbcloud)
    )
  )

    如果没有上述蓝色的TNS项目,启动gsm时会报如下的错误:

GSM-45054: GSM error
GSM-40070: GSM is not able to establish connection to GDS catalog 

    在station5.example.com的/u01/app/oracle/product/12.2.0/gsm_1/network/admin目录下自动配置gsm.ora:

# gsm.ora Network Configuration File: /u01/app/oracle/product/12.2.0/gsm_1/network/admin/gsm.ora
# Generated by Oracle configuration tools.

SQLNET.WALLET_OVERRIDE = TRUE

WALLET_LOCATION =
  (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
      (DIRECTORY = /u01/app/oracle/product/12.2.0/gsm_1/network/admin/gsmwallet)
    )
  )

GSMC02ORCL =
  (configuration =
    (listener =
      (ADDRESS = (HOST = station5.example.com)(PORT = 1572)(PROTOCOL = tcp))
    )
    (cloud = oradbcloud)
  )

5. 创建GDSPOOL,管理Dataguard Broker:   

[oracle@station5 ~]$ . oraenv
ORACLE_SID = [gsm] ? 
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@station5 ~]$ gdsctl
GDSCTL: Version 12.2.0.1.0 - Production on Mon Feb 20 08:54:37 CST 2023

Copyright (c) 2011, 2016, Oracle.  All rights reserved.

Welcome to GDSCTL, type "help" for information.

Current GSM is set to GSMORA
GDSCTL>connect mygdsadmin/oracle_4U@gdscat
GDSCTL>add gdspool -gdspool sales
GDSCTL>add brokerconfig -connect station3:1521:c01orcl1 -region regc01orcl -gdspool sales

    由于上面brokerconfig中的region配置是主库的region,所以需要添加备库信息:

GDSCTL>modify database -database c02orcl -region regc02orcl -gdspool sales -connect station3:1521/c02orcl.example.com 

6. 创建全局服务:

   在station3.example.com上,创建默认连接到物理备库(但是可以failover到主库)的服务sales_r,并设置它的延时容忍为30秒:

GDSCTL> add service -service sales_r -gdspool sales –preferred_all –role PHYSICAL_STANDBY –failover_primary -lag 30

    admin-managed的RAC数据库,需要手工添加实例(policy-managed的RAC数据库,不需要手工添加实例

GDSCTL>  modify service –gdspool sales –service sales_r –database c02orcl –add_instances –preferred c02orcl1,c02orcl2
GDSCTL>  modify service –gdspool sales –service sales_r –database c01orcl –add_instances –preferred c01orcl1,c01orcl2

   在station3.example.com上,创建默认连接物理备库(但是不可以failover到主库)的服务sales_r2,并设置它的select类型漂移属性: 

 

GDSCTL> add service -service sales_r2 -gdspool sales –preferred_all –role PHYSICAL_STANDBY -rlbgoal  SERVICE_TIME -clbgoal LONG -failovertype SELECT -failovermethod BASIC

  

    admin-managed的RAC数据库,需要手工添加实例(policy-managed的RAC数据库,不需要手工添加实例

GDSCTL>  modify service –gdspool sales –service sales_r2 –database c02orcl –add_instances –preferred c02orcl1,c02orcl2
GDSCTL>  modify service –gdspool sales –service sales_r2 –database c01orcl –add_instances –preferred c01orcl1,c01orcl2

    附上modify service的帮助:

GDSCTL>modify service -h
Syntax
(1)
- MODIFY service [-gdspool gdspool_name] -service service_name  {[-preferred db_name_list] | [-available db_name_list]}
(2)
-   MODIFY SERVICE [-gdspool gdspool_name] -service service_name
[-locality {ANYWHERE|LOCAL_ONLY}] [-region_failover]
[-role [PRIMARY | PHYSICAL_STANDBY [-failover_primary] | LOGICAL_STANDBY | SNAPSHOT_STANDBY]] [-lag {lag_value | ANY}] [-notification {TRUE|FALSE}]
[-rlbgoal {SERVICE_TME|THROUGHPUT}] [-clbgoal {SHORT | LONG}] [-tafpolicy {BASIC|NONE|PRECONNECT}] [-policy policy]  [-failovertype {NONE|SESSION|SELECT|TRANSACTION}] [-failovermethod {NONE|BASIC}]
[-dtp {TRUE|FALSE}] [-sql_translation_profile ] [-failoverretry failover_retries] [-failoverdelay failover_delay]
[-edition edition] [-commit_outcome {TRUE|FALSE}] [-retention retention_seconds] [-session_state {DYNAMIC|STATIC}] [-replay_init_time replay_initiation_time] 
(3)
-   MODIFY SERVICE [-gdspool gdspool_name] -service service_name -old_db db_name -new_db db_name [-force]
(4)
-   MODIFY SERVICE [-gdspool gdspool_name] -service service_name -available  db_name_list -preferred
(5)
-   MODIFY SERVICE [-gdspool gdspool_name] -service service_name {-preferred_all | {-modifyconfig  -preferred db_name_list [-available db_name_list]}}
 (6)
-   MODIFY service [-gdspool gdspool_name] -service service_name -database db_name [-server_pool serv_pool_name|(-add_instances| -modify_instances) -preferred inst_list -available inst_list| -drop_instances inst_list] -cardinality {UNIFORM | SINGLETON}
Purpose
(1)
Add additional preferred and/or available databases to a global service.
Error if global service is of -preferred_all type.
(2)
Modify a global service.
(3)
Moves a global service from one database to another database.
Error if global service is of -preferred_all type.
(4)
Make specified available databases be preferred.Error if global service has -preferred_all set (as this would be redundant).
(5)
Change databases between preferred and available status.
(6)
Modify additional properties for a global service specific to a database.
Usage Notes
(1)
At least one preferred database or available database have to be specified.
(3)
If -force is specified, all sessions will be disconnected requiring the session using the global service to reconnect.
If -force is not specified, then sessions already connected to this global service stay connected, but new sessions cannot be established to the global service.
(5)
One of -preferred_all or -preferred must be specified. If preferred_all is specified, then all databases in the pool are preferred for this global service (new databases added to the pool will also have this global service added).
Databases that are not specified in either the preferred list or available list, but were previously assigned, will be removed.
If -force is specified, all sessions will be disconnected requiring the session using the global service to reconnect (potentially to another instance).
If -force is not specified, then sessions already connected to this global service stay connected, but new sessions cannot be established to the global service.
Keywords and Parameters
(1)
-gdspool      the GDS pool.
-service      the global service name.
-preferred   a comma-delimited list of preferred databases.
-available   a comma-delimited list of available databases.
(2)
-gdspool      the GDS pool.
-service      the global service name.
-locality      the global service locality: ( ANYWHERE | LOCAL_ONLY).
-region_failover   enable region failover (LOCAL_ONLY option).
-role      specify the database role that the database must be for this global service to start.  Applies only to GDS pools that contains a Data Guard Broker configuration.
-failover_primary   enable global service for failover to primary.  Applies only to global services with role PHYSICAL_STANDBY.
-lag      specify the lag for the global service: ( number of seconds | "ANY" - for any lag).
-rlbgoal   the runtime load balancing goal: ( SERVICE_TIME | THROUGHPUT).
-clbgoal   the connection time load balancing goal: ( SHORT | LONG).
-notification   AQ HA notifications: ( TRUE | FALSE).
-tafpolicy   TAF policy specification.
-policy      management policy for the global service: ( AUTOMATIC | MANUAL).
-failovertype   failover type: ( NONE|SESSION|SELECT|TRANSACTION).
-failovermethod   failover method: ( NONE | BASIC).
-failoverretry   failover retries.
-failoverdelay   failover delay.
-edition      edition (or "" for empty edition value).
-commit_outcome commit outcome: ( TRUE | FALSE).
-retention   retention time in seconds.
-session_state   session state consistency: ( STATIC | DYNAMIC).
-replay_init_time   replay initiation time in seconds.
-sql_translation_profile SQL translation profile.
-dtp Distributed Transaction Policy: ( TRUE | FALSE).
(3)
-gdspool      the GDS pool.
-service      the global service name.
-old_db      the old database.
-new_db   the new database.
-force      force by disconnecting all sessions.
(4)
-gdspool      the GDS pool.
-service      the global service name.
-available   a comma-delimited list of available databases to upgrade.
-preferred   upgrade database to preferred.
(5)
-gdspool      the GDS pool.
-service      the global service name.
-preferred_all   specify all databases in the GDS pool are preferred.
-modifyconfig   use named databases only.
-preferred   a comma-delimited list of preferred databases.
-available   a comma-delimited list of available databases.
-force      force.
(6)
-gdspool      the GDS pool.
-service      the global service name.
-database   the database name.
-server_pool   the server pool.
-cardinality: (UNIFORM -  global service runs on every active node in the hosting server pool | SINGLETON- just on one node).
-add_instances add instances to configuration.
-modify_instances replace instance configuration.
-drop_instances remove instances from configuration.
-preferred   a comma-delimited list of preferred instances.
-available   a comma-delimited list of available instances.
Examples
(1)
GDSCTL> modify service -gdspool myreaderfarm -service sales_report -preferred db3
(2)
GDSCTL> modify service -gdspool myreaderfarm -service sales_report -rlbgoal THROUGHPUT
(3)
GDSCTL> modify service -gdspool myreaderfarm -service sales_report -old_db db1 -new_db db2
(4)
GDSCTL> modify service -gdspool myreaderfarm -service sales_report -available db2 -preferred
(5)
GDSCTL> modify service -gdspool myreaderfarm -service sales_report -preferred_all
(6)
GDSCTL> modify service -gdspool myreaderfarm -service sales_report -database db1 -server_pool serverpool1


    验证数据库信息:

GDSCTL>databases
Database: "c01orcl" Registered: N State: Ok ONS: Y. Role: N/A Instances: 0 Region: regc01orcl
   Service: "sales_r" Globally started: Y Started: N
            Scan: Y Enabled: Y Preferred: Y
   Service: "sales_r2" Globally started: Y Started: N
            Scan: Y Enabled: Y Preferred: Y
Database: "c02orcl" Registered: N State: Warnings ONS: Y. Role: N/A Instances: 0 Region: regc02orcl
   Service: "sales_r" Globally started: Y Started: N
            Scan: Y Enabled: Y Preferred: Y
   Service: "sales_r2" Globally started: Y Started: N
            Scan: Y Enabled: Y Preferred: Y

    验证服务信息:

GDSCTL>services
Service "sales_r.sales.oradbcloud" has 2 instance(s). Affinity: ANYWHERE
   Instance "sales%11", name: "c02orcl1", db: "c02orcl", region: "regc02orcl", status: ready.
   Instance "sales%12", name: "c02orcl2", db: "c02orcl", region: "regc02orcl", status: ready.
Service "sales_r2.sales.oradbcloud" has 2 instance(s). Affinity: ANYWHERE
   Instance "sales%11", name: "c02orcl1", db: "c02orcl", region: "regc02orcl", status: ready.
   Instance "sales%12", name: "c02orcl2", db: "c02orcl", region: "regc02orcl", status: ready.

    客户端的TNS配置:

sales_r2 =
  (DESCRIPTION =
   (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = station3.example.com)(PORT = 1571))
    (ADDRESS = (PROTOCOL = TCP)(HOST = station5.example.com)(PORT = 1572))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = sales_r2.sales.oradbcloud)
    )
)


sales_r =
  (DESCRIPTION =
   (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = station3.example.com)(PORT = 1571))
    (ADDRESS = (PROTOCOL = TCP)(HOST = station5.example.com)(PORT = 1572))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = sales_r.sales.oradbcloud)
    )
)





路过

雷人

握手

鲜花

鸡蛋

QQ|手机版|Bo's Oracle Station   

GMT+8, 2023-4-3 15:02 , Processed in 0.021290 second(s), 21 queries .

返回顶部