在原有的oracle11g数据库上创建第二套数据库并连接
在原有的oracle11g数据库上创建第二套数据库并连接
1 创建第二套数据库
注:11g、12c、19c在创建数据库上面可能稍有差异,但是创建方法一样,连接方法也一样。
2 连接第二套数据库(临时连接)
# oracle用户执行命令
echo $ORACLE_SID
ORCL
sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Mar 9 22:48:19 2020 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@ORCL>
export ORACLE_SID=PROD
echo $ORACLE_SID
PROD
sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Mar 9 22:46:52 2020 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@PROD>
永久切换第二套数据库只需修改oracle用户变量然后source生效即可