先说基本用法:
先按11G之前进行
conn / as sysdba;
create user test identifed by test;
ORA-65096: 公用用户名或角色名无效.
查官方文档得知“试图创建一个通用用户,必需要用C##或者c##开头”,这时候心里会有疑问,什么是common user?不管先建成功了再说
create C##user test identifed by test;
创建成功
SQL>show con_name;
CON_NAME
------------------------------
CDB$ROOT
select
con_id,dbid,
NAME
,OPEN_MODE
from
v$pdbs;
CON_ID DBID NAME OPEN_MODE ---------- ---------- ------------------------------ ----------
2 4066409480 PDB$SEED READ ONLY
3 2270995695 PDBORCL MOUNTED
SQL>alter session set container=PDBORCL;
这时再用create user test identifed by test;建立用户就可以了。
ORA-01219 :数据库未打开:仅允许在固定表/视图中查询 解决!
ORA-01219:database not open:queries allowed on fixed tables/views only
“ORA-01219:数据库未打开:仅允许在固定表/视图中查询”的警告窗口!
解决办法:
登录Oracle SQL*Plus
C:\Users\Administrator>
C:\Users\Administrator>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on 星期二 1月 29 10:54:36 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> connect sys/sys as sysdba
这一段是找出打开数据库的时候报错的地方
SQL> select open_mode from v$database;
OPEN_MODE
----------
MOUNTED
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: '/data/app/oradata/ora237/users01.dbf'
这里就是讲'/data/app/oradata/ora237/users01.dbf'这个文件出问题
我们要做的就是删掉这个残留文件
进行下一步:
SQL> alter database datafile '/data/app/oradata/ora237/users01.dbf' offline drop;
Database altered.
SQL> alter database open;
Database altered.