1、启动
1)启用目录数据库和监听
2)启动GSM(Shard directors)
3)启动分片的数据库、监听、代理
4)启动全局服务(global service)
5)通过Service连接sharing
1.1 启动目录数据库和监听
[oracle@gsm1 ~]$ sqlplus / as sysdba
SQL> startup
SQL> exit
[oracle@gsm1 ~]$ lsnrctl start
[oracle@gsm1 ~]$ lsnrctl status
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=gsm1)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=gsm1)(PORT=8080))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "GDS$CATALOG.oradbcloud" has 1 instance(s).
Instance "catadb", status READY, has 1 handler(s) for this service...
Service "catadb" has 1 instance(s).
Instance "catadb", status READY, has 1 handler(s) for this service...
Service "catadbXDB" has 1 instance(s).
Instance "catadb", status READY, has 1 handler(s) for this service...
The command completed successfully
1.2 启动GSM(Shard directors)
[gds@gsm1 ~]$ gdsctl
Current GSM is set to SHARDDIRECTOR3
GDSCTL>connect mygds/oracle
GDSCTL>start gsm
GDSCTL>status gsm
Alias SHARDDIRECTOR3
Version 12.2.0.1.0
Start Date 07-MAR-2020 12:12:56
Trace Level off
Listener Log File /u05/app/oracle/diag/gsm/gsm1/sharddirector3/alert/log.xml
Listener Trace File /u05/app/oracle/diag/gsm/gsm1/sharddirector3/trace/ora_2852_140100292587904.trc
Endpoint summary (ADDRESS=(HOST=gsm1)(PORT=1522)(PROTOCOL=tcp))
GSMOCI Version 2.2.1
Mastership Y
Connected to GDS catalog Y
Process Id 2855
Number of reconnections 0
Pending tasks. Total 0
Tasks in process. Total 0
Regional Mastership TRUE
Total messages published 0
Time Zone +08:00
Orphaned Buddy Regions:
None
GDS region region1
1.3. 启动分片的数据库、监听、代理
#可以通过config shard目录查看到当前Sharding环境中分片的信息:
GDSCTL>config shard
Name Shard Group Status State Region Availability
---- ----------- ------ ----- ------ ------------
sh1 primary_shardgroup Ok Deployed region1 -
sh2 primary_shardgroup Ok Deployed region1 -
#sd1
[oracle@sd1 ~]$ export ORACLE_SID=sh1
[oracle@sd1 ~]$ sqlplus / as sysdba
SQL> startup
SQL> !lsnrctl start
SQL> !schagent -start
SQL> !schagent -status
#sd2
[oracle@sd2 ~]$ export ORACLE_SID=sh2
[oracle@sd2 ~]$ sqlplus / as sysdba
SQL> startup
SQL> !lsnrctl start
SQL> !schagent -start
SQL> !schagent -status
1.4. 启动全局服务
#检查service状态:
GDSCTL>status service
Service "oltp_rw_srvc.shdb.oradbcloud" has 2 instance(s). Affinity: ANYWHERE
Instance "shdb%1", name: "sh1", db: "sh1", region: "region1", status: ready.
Instance "shdb%11", name: "sh2", db: "sh2", region: "region1", status: ready.
GDSCTL>config service
Name Network name Pool Started Preferred all
---- ------------ ---- ------- -------------
oltp_rw_srvc oltp_rw_srvc.shdb.oradbcloud shdb Yes Yes
#如果没有启用使用start service启动(上行 Started =Yes 表示已启动):
GDSCTL> start service -service oltp_rw_srvc
GDSCTL>config shard
Name Shard Group Status State Region Availability
---- ----------- ------ ----- ------ ------------
sh1 primary_shardgroup Ok Deployed region1 ONLINE
sh2 primary_shardgroup Ok Deployed region1 ONLINE
GDSCTL>databases
Database: "sh1" Registered: Y State: Ok ONS: N. Role: PRIMARY Instances: 1 Region: region1
Service: "oltp_rw_srvc" Globally started: Y Started: Y
Scan: N Enabled: Y Preferred: Y
Registered instances:
shdb%1
Database: "sh2" Registered: Y State: Ok ONS: N. Role: PRIMARY Instances: 1 Region: region1
Service: "oltp_rw_srvc" Globally started: Y Started: Y
Scan: N Enabled: Y Preferred: Y
Registered instances:
shdb%11
1.5. 通过Service连接sharding
[oracle@gsm1 ~]$ sqlplus / as sysdba
SQL>
set lines 120
col name for a20
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
_cloud_name string oradbcloud
cdb_cluster_name string catadb
cell_offloadgroup_name string
db_file_name_convert string
db_name string catadb
db_unique_name string catadb
global_names boolean FALSE
instance_name string catadb
lock_name_space string
log_file_name_convert string
pdb_file_name_convert string
processor_group_name string
service_names string catadb
2、停止
关闭顺序和打开顺序相反:
1)关闭连接池和客户端
2)关闭全局服务
3)关闭分片的数据库和监听
4)关闭GSM
5)关闭目录数据库和监听
2.1.关闭服务:
[gds@gsm1 ~]$ gdsctl
Current GSM is set to SHARDDIRECTOR3
GDSCTL>config service
Name Network name Pool Started Preferred all
---- ------------ ---- ------- -------------
oltp_rw_srvc oltp_rw_srvc.shdb.oradbcloud shdb Yes Yes
GDSCTL>stop service -gdspool shdb -service oltp_rw_srvc
GDSCTL>config service
Name Network name Pool Started Preferred all
---- ------------ ---- ------- -------------
oltp_rw_srvc oltp_rw_srvc.shdb.oradbcloud shdb Yes Yes
2.2.在每个分片关闭数据库、监听、代理
#sd1
[oracle@sd1 ~]$ lsnrctl stop
[oracle@sd1 ~]$ schagent -stop
[oracle@sd1 ~]$ ps -ef|grep smon
oracle 12397 1 0 Mar06 ? 00:00:00 ora_smon_sh1
oracle 17571 1623 0 00:16 pts/0 00:00:00 grep --color=auto smon
[oracle@sd1 ~]$ export ORACLE_SID=sh1
[oracle@sd1 ~]$ sqlplus / as sysdba
SQL> shutdown immediate
#sd2
[oracle@sd2 oradata]$ lsnrctl stop
[oracle@sd2 oradata]$ schagent -stop
[oracle@sd2 oradata]$ ps -ef|grep smon
oracle 11966 1 0 Mar06 ? 00:00:00 ora_smon_sh2
oracle 17251 1716 0 00:19 pts/0 00:00:00 grep --color=auto smon
[oracle@sd2 oradata]$ export ORACLE_SID=sh2
[oracle@sd2 oradata]$ sqlplus / as sysdba
SQL> shutdown immediate
2.3. 关闭GSM
GDSCTL>config gsm
Name Region ENDPOINT
---- ------ --------
sharddirector3 region1 (ADDRESS=(HOST=gsm1)(PORT=1522)(PROTOCOL=tcp))
GDSCTL>stop gsm -gsm sharddirector3
GSM is stopped successfully
GDSCTL>config gsm
Name Region ENDPOINT
---- ------ --------
sharddirector3 region1 (ADDRESS=(HOST=gsm1)(PORT=1522)(PROTOCOL=tcp))
GDSCTL>config gsm -gsm sharddirector3
Name: sharddirector3
Endpoint 1: (ADDRESS=(HOST=gsm1)(PORT=1522)(PROTOCOL=tcp))
Local ONS port: 6123
Remote ONS port: 6234
ORACLE_HOME path: /u05/app/oracle/product/12.2.0/gsm_1
GSM Host name: gsm1
Region: region1
Buddy
------------------------
GDSCTL>status gsm
GSM-45075: No response from GSM
2.4 关闭目录数据库和监听(gsm1)
[oracle@gsm1 ~]$ lsnrctl stop
[oracle@gsm1 ~]$ sqlplus / as sysdba
SQL> shutdown immediate
查看监听状态
[gds@gsm1 ~]$ lsnrctl status sharddirector3
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 07-MAR-2020 00:31:21
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(HOST=gsm1)(PORT=1522)(PROTOCOL=tcp))(CONNECT_DATA=(SERVICE_NAME=GDS$CATALOG.oradbcloud)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
网友评论