-- 开始创建数据库 CREATE USER IPDRPMG IDENTIFIED BY Pei123456 DEFAULT TABLESPACE IPDRPMG TEMPORARY TABLESPACE IPDRPMG;
-- 授权 grant create session to IPDRPMG;
grant create table to IPDRPMG;
grant unlimited tablespace to IPDRPMG;
-- 最后修改一下密码 ALTER USER IPDRPMG IDENTIFIED BY Pei123456;
7、创建用户
SQL>create user IPDRPMG identified by Pei123456; # 创建表空间: create tablespace IPDRPMG datafile '/opt/oracle/oradata/IPDRPMG/data.dbf' size 5m; # tablespacename:表空间的名字 # d:\data.dbf':表空间的存储位置 # xxx表空间的大小,m单位为兆(M) # 将空间分配给用户: alter user ipdrpmg default tablespace "IPDRPMG"; # alter user SYSTEM default tablespace IPDRPMG; # 将名字为tablespacename的表空间分配给username
# 给用户授权: grant create session,create table,unlimited tablespace to ipdrpmg; # 授权 grant create session to IPDRPMG; grant create table to IPDRPMG; grant unlimited tablespace to IPDRPMG; SQL>grant dba to IPDRPMG;
8、所有scheme、table查看
# 可以查出所有的schema SQL> select username from sys.dba_users; # 可以查出来schema对应的表名 ### select table_name from dba_tables where owner='schema名称'; SQL> select table_name from dba_tables where owner='IPDRPMG';
##### 遇到的问题: SQL> conn ipdrpmg@ipdrpmg Enter password: ERROR: ORA-01017: invalid username/password; logon denied Warning: You are no longer connected to ORACLE.
### 解决办法: conn system/Pei123456;
create user c##ipdrpmg identified by Pei123456;
grant connect to c##ipdrpmg;
conn c##ipdrpmg/Pei123456;
9、Oracle修改实例用户密码
su oracle sqlplus / as sysdba conn /as sysdba show pdbs; # alter session set container = 实例名称; alter session set container = topc; # alter user 用户名 identified by 密码; alter user dwroot identified by Abc1234567;
7、最后成功创建的步骤
SQL> create pluggable database IPDRPMG admin user ipdrpmg identified by Abc1234567 role = (resources) file_name_convert=('/opt/oracle/oradata/ORCLCDB/pdbseed', '/opt/oracle/oradata/IPDRPMG')
----用户 ipdrpmg Abc1234567 SQL> alter session set container = ipdrpmg; SQL> show pdbs;
--关闭 database SQL> alter pluggable database ipdrpmg close immediate; --开启 database SQL> alter pluggable database ipdrpmg open;