ORACLE 切换个实例,启动多个实例

//切换用户
[root@CentosDB ~]# su - oracle
上一次登录:五 7月 16 10:05:08 CST 2021pts/0 上
//切换实例
[oracle@CentosDB ~]$ export ORACLE_SID=orcl
[oracle@CentosDB ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jul 16 11:33:44 2021

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

SQL> conn / as sysdba
Connected.
SQL> show parameter name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string
db_name                              string      orcl
db_unique_name                       string      orcl
global_names                         boolean     FALSE
instance_name                        string      orcl
lock_name_space                      string
log_file_name_convert                string
service_names                        string      orcl
SQL>
//切换到另一个实例
[oracle@CentosDB ~]$ export ORACLE_SID=orcl
[oracle@CentosDB ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jul 16 11:33:44 2021

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

SQL> show parameter name
SP2-0640: Not connected
SQL> conn / as sysdba
Connected.
SQL> show parameter name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string
db_name                              string      orcl
db_unique_name                       string      orcl
global_names                         boolean     FALSE
instance_name                        string      orcl
lock_name_space                      string
log_file_name_convert                string
service_names                        string      orcl
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@CentosDB ~]$ clear
[oracle@CentosDB ~]$ export ORACLE_SID=zsny
[oracle@CentosDB ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jul 16 11:38:12 2021

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

SQL> conn / as sysdba
Connected to an idle instance.
SQL> show parameter name
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0

//启动另一个实例
SQL> startup
ORACLE instance started.

Total System Global Area 1302769664 bytes
Fixed Size                  2213056 bytes
Variable Size             805309248 bytes
Database Buffers          486539264 bytes
Redo Buffers                8708096 bytes
Database mounted.
Database opened.
SQL>
//启动监听
[oracle@CentosDB ~]$ lsnrctl start
[root@CentosDB ~]# su - oracle
上一次登录:三 10月 20 09:53:30 CST 2021pts/0 上
//关闭监听器
[oracle@CentosDB ~]$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 20-OCT-2021 10:20:00

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
The command completed successfully
[oracle@CentosDB ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Oct 20 10:20:53 2021

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

SQL> conn / as sysdba
Connected to an idle instance.
SQL> shutdown immediate
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
//关闭数据库
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
//启动数据库
SQL> startup
ORACLE instance started.

Total System Global Area 1904054272 bytes
Fixed Size                  2214496 bytes
Variable Size            1442842016 bytes
Database Buffers          452984832 bytes
Redo Buffers                6012928 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64                                                                                        bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
//启动监听器
[oracle@CentosDB ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 20-OCT-2021 10:22:43

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

Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/liste                                                                                        ner.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/CentosDB/listener/alert/log                                                                                        .xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                20-OCT-2021 10:22:43
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/list                                                                                        ener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/CentosDB/listener/alert/l                                                                                        og.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@CentosDB ~]$

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值