oracle select with read only,ORA-65085: cannot open pluggable database in read-only mode问题解决

SQL> show con_name

CON_NAME

------------------------------

CDB$ROOT

SQL> show pdbs

CON_ID CON_NAME  OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

2 PDB$SEED  READ ONLY  NO

3 PDB  READ WRITE NO

4 TEST  MOUNTED

SQL> show con_name

CON_NAME

------------------------------

CDB$ROOT

SQL> alter pluggable database test open read only;

alter pluggable database test open read only

*

ERROR at line 1:

ORA-65085: cannot open pluggable database in read-only mode

SQL> col pdb_name for a20

SQL> col status for a40

SQL> select pdb_name,status from dba_pdbs;

PDB_NAME     STATUS

-------------------- ----------------------------------------

PDB     NORMAL

PDB$SEED     NORMAL

TEST     NEW

pdb的status有NEW、NORMAL、UNPLUGGED、NEEDS UPGRADE、CONVERTING、UNUSABLE几种状态,对这几种状态的解释如下:

NEW - The PDB has never been opened since it was created. It must be opened in READ WRITE mode for Oracle to perform processing needed to complete the integration of the PDB into the CDB and mark it NORMAL. An error will be thrown if an attempt is made to open the PDB read only.

NORMAL - The PDB is ready to be used.

UNPLUGGED - The PDB has been unplugged. The only operation that can be performed on it is DROP PLUGGABLE DATABASE.

NEEDS UPGRADE - A PDB needs to be upgraded to the version of the CDB into which it was plugged.

CONVERTING - A non-CDB was plugged into the CDB and is undergoing conversion required to make it behave like a real PDB.

UNUSABLE - The PDB is being created or an unrecoverable error was encountered during its creation. The PDB cannot be opened while its state is set to UNUSABLE. If the PDB remains in this state because of an error encountered during its creation, it can only be dropped. The alert log can be checked to determine if there was an error

during PDB creation.

通过上面对status几种状态的说明,对属于NEW的pdb,需要先open。

SQL> alter pluggable database test open;

再对数据库操作open read only操作:

[oracle@ora12c ~]$ sqlplus sys/oracle@192.168.10.31:1521/test as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue Dec 1 09:53:23 2015

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

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> show pdbs

CON_ID CON_NAME  OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

4 TEST  READ WRITE NO

SQL> shutdown immediate;

Pluggable Database closed.

SQL> alter database open read only;

Database altered.

SQL> show pdbs

CON_ID CON_NAME  OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

4 TEST  READ ONLY  NO

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值