select * from dba_users where USERNAME LIKE ‘%DPBI%’;-- 查询用户
select * from dba_tablespaces;-- 查询表空间
drop user c##dpbi cascade;-- 删除用户
drop tablespace DPBI ;-- 删除表空间
– 查询pdb
select con_id,dbid,guid,name,open_mode from v$pdbs;
– 更改pdb状态
alter pluggable database ORCLPDB open;
– 更改当前会话到某个pdb
alter session set container=ORCLPDB;
– 在pdb中创建用户
create user dpbi identified by dpbi123 default tablespace DPBI_ORCL temporary tablespace temp;
– 更改用户密码
alter user dpbi identified by dpbi123;
– 用户授权
grant create user,drop user,alter user,create any view,connect,resource,dba,create session,create any sequence to dpbi ;
– 创建表空间
CREATE BIGFILE TABLESPACE “DPBI_ORCL”
DATAFILE ‘F:\DBF\DPBI_ORCL.DBF’
SIZE 100m AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
– 创建触发器每次打开oracle服务自动打开pdb
drop trigger open_pdbs;
CREATE OR REPLACE TRIGGER open_pdbs
AFTER STARTUP ON DATABASE
BEGIN
EXECUTE IMMEDIATE ‘alter pluggable database ORCLPDB open’;
END open_pdbs;
/