oracle创建用户并指定表空间

时间:2022-03-28 20:28:18

/*第1步:创建ODPS数据表空间 */
create tablespace ODPS
logging datafile '/home/oracle/tablespace_dir/ODPS.dbf'
size 100m autoextend on
next 50m maxsize 20480m extent management local;

/*第2步:创建global用户并指定表空间 */
create user global identified by global
default tablespace ODPS
temporary tablespace temp profile default;

/*第3步:给global用户授予权限 */
grant connect,resource to global;
grant dba to global;

/*第4步:远程导入dmp文件*/
cd /d D:\oraclexe\app\oracle\product\11.2.0\server\bin

imp global/global@192.168.0.1:1521/wzhorcl file=G:\global.dmp full=y

/*第5步:给ydbggl用户授权访问global用户下的资源*/
select 'GRANT SELECT ON global.'||object_name||' to ydbggl;' from dba_objects where owner='GLOBAL' and object_type='TABLE';