我的Oracle中创建了多个数据库,我应该如何在数据库之间进行切换呢1、在不退出sqlplus的情况下,直接在命令行输入conn username/password;即可完成切换 。
2、在退出sqlplus的情况下,windows下:set ORACLE_SID=db_name; linux下:export ORACLE_SID = db_name再登录相应的用户即可完成切换 。
3、创建用户命令:create user usernamer identified by passwd;
4、给用户赋权限:grant connect,resource,dba to username;
oracle数据库如何切换模式oracle dg 三大模式切换
1、最大性能模式MAXIMUM PERFORMANCE --默认模式,最大性能模式特点 。
192.168.1.181
SQL select database_role,protection_mode,protection_level from v$database;
DATABASE_ROLEPROTECTION_MODEPROTECTION_LEVEL
---------------- -------------------- --------------------
PRIMARYMAXIMUM PERFORMANCE MAXIMUM PERFORMANCE
SQL col dest_name for a25
SQL select dest_name,status from v$archive_dest_status;
DEST_NAMESTATUS
------------------------- ---------
LOG_ARCHIVE_DEST_1VALID
LOG_ARCHIVE_DEST_2VALID
SQL show parameter log_archive
NAMETYPEVALUE
------------------------------------ ----------- ---------------------------
log_archive_configstringdg_config=(orcl,db01)
log_archive_dest_1stringlocation=/home/oracle/arch_orc
l valid_for=(all_logfiles,all_
roles) db_unique_name=orcl
log_archive_dest_2stringservice=db_db01 LGWR ASYNC val
id_for=(online_logfiles,primar
y_roles) db_unique_name=db01
SQL archive log list
Database log modeArchive Mode
Automatic archivalEnabled
Archive destination/home/oracle/arch_orcl
Oldest online log sequence31
Next log sequence to archive33
Current log sequence33
192.168.1.183
SQL select database_role,protection_mode,protection_level from v$database;
DATABASE_ROLEPROTECTION_MODEPROTECTION_LEVEL
---------------- -------------------- --------------------
PHYSICAL STANDBY MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE
SQL col dest_name for a25
SQL select dest_name,status from v$archive_dest_status;
DEST_NAMESTATUS
------------------------- ---------
LOG_ARCHIVE_DEST_1VALID
LOG_ARCHIVE_DEST_2VALID
SQL show parameter log_archive
NAMETYPEVALUE
------------------------------------ ----------- ---------------------------
log_archive_configstringdg_config=(db01,orcl)
log_archive_dest_1stringlocation=/home/oracle/arch_db0
1 valid_for=(all_logfiles,all_
roles) db_unique_name=db01
log_archive_dest_2stringservice=db_orcl LGWR ASYNC val
id_for=(online_logfiles,primar
y_roles) db_unique_name=orcl
SQL archive log list
Database log modeArchive Mode
Automatic archivalEnabled
Archive destination/home/oracle/arch_orcl
Oldest online log sequence31
Next log sequence to archive33
Current log sequence33
192.168.1.181
SQL alter system switch logfile;
SQL archive log list
Database log modeArchive Mode
Automatic archivalEnabled
Archive destination/home/oracle/arch_orcl
Oldest online log sequence32
Next log sequence to archive34
Current log sequence34
192.168.1.183
SQL archive log list
Database log modeArchive Mode
Automatic archivalEnabled
Archive destination/home/oracle/arch_db01
Oldest online log sequence32
Next log sequence to archive0
Current log sequence34
2 、最大性能模式--切换到--最大高可用(默认是最大性能模式---MAXIMUM PERFORMANCE) 。
192.168.1.181
SQL select DATABASE_ROLE,PROTECTION_MODE,PROTECTION_LEVEL from v$database;
DATABASE_ROLEPROTECTION_MODEPROTECTION_LEVEL
---------------- -------------------- --------------------
PRIMARYMAXIMUM PERFORMANCE MAXIMUM PERFORMANCE
SQL show parameter log_archive_dest_2
NAMETYPEVALUE
------------------------------------ ----------- ---------------------------
log_archive_dest_2stringservice=db_db01 LGWR ASYNC val
id_for=(online_logfiles,primar
y_roles) db_unique_name=db01
192.168.1.181
SQL shutdown immediate
192.168.1.183
SQL alter database recover managed standby database cancel;
SQL shutdown immediate
192.168.1.181
SQL startup mount;
SQL alter database set standby database to maximize availability;
SQL alter system set log_archive_dest_2='service=db_db01 LGWR SYNC valid_for=(online_logfiles,primary_roles) db_unique_name=db01' scope=spfile;
192.168.1.183
SQL startup nomount
SQL alter database mount standby database;
SQL alter system set log_archive_dest_2='service=db_orcl LGWR SYNC valid_for=(online_logfiles,primary_roles) db_unique_name=orcl' scope=spfile;
SQL shutdown immediate
SQL startup nomount
SQL alter database mount standby database;
192.168.1.181
SQL startup
SQL col dest_name for a25
SQL select dest_name,status from v$archive_dest_status;
DEST_NAMESTATUS
------------------------- ---------
LOG_ARCHIVE_DEST_1VALID
LOG_ARCHIVE_DEST_2VALID
SQL show parameter log_archive_dest_2
NAMETYPEVALUE
------------------------------------ ----------- ---------------------------
log_archive_dest_2stringservice=db_db01 LGWR SYNC vali
d_for=(online_logfiles,primary
_roles) db_unique_name=db01
SQL select database_role,protection_level,protection_mode from v$database;
DATABASE_ROLEPROTECTION_LEVELPROTECTION_MODE
---------------- -------------------- --------------------
PRIMARYMAXIMUM AVAILABILITY MAXIMUM AVAILABILITY
SQL archive log list
Database log modeArchive Mode
Automatic archivalEnabled
Archive destination/home/oracle/arch_orcl
Oldest online log sequence34
Next log sequence to archive36
Current log sequence36
192.168.1.183
SQL col dest_name for a25
SQL select dest_name,status from v$archive_dest_status;
DEST_NAMESTATUS
------------------------- ---------
LOG_ARCHIVE_DEST_1VALID
LOG_ARCHIVE_DEST_2VALID
SQL show parameter log_archive_dest_2
NAMETYPEVALUE
------------------------------------ ----------- ---------------------------
log_archive_dest_2stringservice=db_orcl LGWR SYNC vali
d_for=(online_logfiles,primary
_roles) db_unique_name=orcl
SQL select database_role,protection_level,protection_mode from v$database;
DATABASE_ROLEPROTECTION_LEVELPROTECTION_MODE
---------------- -------------------- --------------------
PHYSICAL STANDBY MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY
SQL archive log list
Database log modeArchive Mode
Automatic archivalEnabled
Archive destination/home/oracle/arch_db01
Oldest online log sequence35
Next log sequence to archive0
Current log sequence36
192.168.1.181
SQL alter system switch logfile;
SQL archive log list
Database log modeArchive Mode
Automatic archivalEnabled
Archive destination/home/oracle/arch_orcl
Oldest online log sequence35
Next log sequence to archive37
Current log sequence37
192.168.1.183
SQL archive log list
Database log modeArchive Mode
Automatic archivalEnabled
Archive destination/home/oracle/arch_db01
Oldest online log sequence36
Next log sequence to archive0
Current log sequence37
3、最大高可用--切换到--最保护能模式,DG最大保护模式Maximum protection 。
192.168.1.181
SQL shutdown immediate
192.168.1.183
SQL shutdown immediate
192.168.1.181
SQL alter database set standby database to maximize protection;
SQL shutdown immediate
192.168.1.183
SQL startup nomount
SQL alter database mount standby database;
192.168.1.181
SQL startup
SQL col dest_name for a25
SQL select dest_name,status from v$archive_dest_status;
DEST_NAMESTATUS
------------------------- ---------
LOG_ARCHIVE_DEST_1VALID
LOG_ARCHIVE_DEST_2VALID
SQL show parameter log_archive_dest_2
NAMETYPEVALUE
------------------------------------ ----------- ---------------------------
log_archive_dest_2stringservice=db_db01 LGWR SYNC vali
d_for=(online_logfiles,primary
_roles) db_unique_name=db01
SQL select database_role,protection_level,protection_mode from v$database;
DATABASE_ROLEPROTECTION_LEVELPROTECTION_MODE
---------------- -------------------- --------------------
PRIMARYMAXIMUM PROTECTIONMAXIMUM PROTECTION
SQL archive log list
Database log modeArchive Mode
Automatic archivalEnabled
Archive destination/home/oracle/arch_orcl
Oldest online log sequence37
Next log sequence to archive39
Current log sequence39
192.168.1.183
SQL col dest_name for a25
SQL select dest_name,status from v$archive_dest_status;
DEST_NAMESTATUS
------------------------- ---------
LOG_ARCHIVE_DEST_1VALID
【oracle如何切换 oracle切换用户登录】LOG_ARCHIVE_DEST_2VALID
SQL show parameter log_archive_dest_2
NAMETYPEVALUE
------------------------------------ ----------- ---------------------------
log_archive_dest_2stringservice=db_db01 LGWR SYNC vali
d_for=(online_logfiles,primary
_roles) db_unique_name=db01
SQL select database_role,protection_level,protection_mode from v$database;
DATABASE_ROLEPROTECTION_LEVELPROTECTION_MODE
---------------- -------------------- --------------------
PRIMARYMAXIMUM PROTECTIONMAXIMUM PROTECTION
SQL archive log list
Database log modeArchive Mode
Automatic archivalEnabled
Archive destination/home/oracle/arch_db01
Oldest online log sequence37
Next log sequence to archive0
Current log sequence39
192.168.1.181
SQL alter system switch logfile;
SQL archive log list
Database log modeArchive Mode
Automatic archivalEnabled
Archive destination/home/oracle/arch_orcl
Oldest online log sequence38
Next log sequence to archive40
Current log sequence40
192.168.1.183
SQL archive log list
Database log modeArchive Mode
Automatic archivalEnabled
Archive destination/home/oracle/arch_db01
Oldest online log sequence37
Next log sequence to archive0
Current log sequence40
ORACLE如何切换到用户需要的数据库?直接登录相应的用户就可以了 。
步骤:直接在命令行输入sqlconn
username/password;即可完成切换.
解释:每个用户都只能默认一个数据库,不可能出现多个数据库 。所以直接切换到需要的用户下即可完成操作 。
oracle如何切换的介绍就聊到这里吧,感谢你花时间阅读本站内容 , 更多关于oracle切换用户登录、oracle如何切换的信息别忘了在本站进行查找喔 。
推荐阅读
- ios开发中打开闪光灯,ios开发中打开闪光灯的方法
- 网络营销外包推广效果如何,互联网营销外包推广
- python应用开发实战pdf,python应用开发基础课本课后题
- mysql怎么查拼音 mysql 拼音模糊查询
- u盘后损坏数据怎么恢复数据,u盘损坏怎么恢复原来数据
- 女生经营公司游戏,很火的女生经营游戏
- erp消息通知系统设计,erp消息通知系统设计怎么写
- php数据加减乘除 php怎么求和
- html5手机点击图片放大,html5手机点击图片放大怎么弄