windows安装oracle后创建PDB命令
--进入数据库
sqlplus / as sysdba
---查看pdb位置
SELECT name FROM v$datafile;
---创建PDB
CREATE PLUGGABLE DATABASE pdb1 ADMIN USER adminpdb1 IDENTIFIED BY adminpdb1 STORAGE (MAXSIZE 2G) DEFAULT TABLESPACE tab_pdb1 DATAFILE 'E:\ORACLE\INSTALL\ORADATA\FREE\pdb1\pdb01.DBF' SIZE 150M AUTOEXTEND ON PATH_PREFIX = 'E:\ORACLE\Install\ORACLEDATA\FREE\pdb1\' FILE_NAME_CONVERT =('E:\ORACLE\INSTALL\ORADATA\FREE\pdbseed\','E:\ORACLE\INSTALL\ORADATA\FREE\pdb1\');
---打开PDB
ALTER PLUGGABLE DATABASE cndbapdb OPEN;
--查看所属PDB或CDB
show con_name
--查看所有pdb
show pdbs;
--切换空间位置CDB——》PDB
alter session set container=cndbapdb;
--创建表空间
create tablespace orms_TBS datafile 'E:\ORACLE\ORACLE_DATA\ORCL\CNDBAPDB\orms1.DBF' size 1G autoextend on next 100M maxsize unlimited extent management local AUTOALLOCATE SEGMENT space MANAGEMENT AUTO;
---创建索引表空间
create tablespace orms_TBS_INDEX datafile 'E:\ORACLE\ORACLE_DATA\ORCL\CNDBAPDB\orms1_index.DBF' size 100M autoextend on next 100M maxsize unlimited extent management local AUTOALLOCATE SEGMENT space MANAGEMENT AUTO;
---创建临时表空间
create temporary tablespace temp_data tempfile 'E:\ORACLE\ORACLE_DATA\ORCL\CNDBAPDB\orms1_temp.DBF' size 100M reuse autoextend on next 100M maxsize unlimited ;
---创建用户
create user orms identified by orms123 default tablespace orms_TBS temporary tablespace temp_data;
---赋予角色
grant connect,resource to orms;
---分配权限
grant create procedure to orms with admin option;
grant create sequence to orms;
grant create session to orms;
grant create synonym to orms;
grant create table to orms;
grant create trigger to orms;
grant create type to orms;
grant create view to orms;
grant unlimited tablespace to orms;
grant create job to orms;
grant select on V_$SQLAREA to orms;
grant select on V_$SESSION to orms;
grant select on V_$LOCKED_OBJECT to orms;
grant select on V_$PARAMETER to orms;
grant select on V_$PROCESS to orms;
grant select on V_$RECOVERY_FILE_DEST to orms;
grant select on DBA_FREE_SPACE to orms;
grant select on DBA_DATA_FILES to orms;