Oracle 表文件,表空间,用户,的创建 和删除

前端之家收集整理的这篇文章主要介绍了Oracle 表文件,表空间,用户,的创建 和删除前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

wKioL1fJOXjCNIiFAAAeVsMyoTA090.png


本文谢绝转载,原文来自http://990487026.blog.51cto.com


连接超级用户:

[oracle@oracle11~]$sqlplus/nolog
sql>conn/assysdba
Connected.


查数据文件:

sql>select*fromv$dbfile;
	4/opt/oracle/app/oradata/orcl/users01.dbf
	3/opt/oracle/app/oradata/orcl/undotbs01.dbf
	2/opt/oracle/app/oradata/orcl/sysaux01.dbf
	1/opt/oracle/app/oradata/orcl/system01.dbf
	5/opt/oracle/app/oradata/orcl/example01.dbf
	6/opt/oracle/app/oradata/orcl/ts_seckeymng_admin.dbf

6rowsselected.


查看所有表空间

sql>select*fromv$tablespace;
	0SYSTEM			YESNOYES
	1SYSAUX			YESNOYES
	2UNDOTBS1			YESNOYES
	4USERS			YESNOYES
	3TEMP			NONOYES
	6EXAMPLE			YESNOYES
	7TS_SECKEY_ADMIN		YESNOYES

7rowsselected.

查看表空间的数据文件

sql>selectfile_name,tablespace_namefromdba_data_files;
/opt/oracle/app/oradata/orcl/users01.dbf									USERS
/opt/oracle/app/oradata/orcl/undotbs01.dbf									UNDOTBS1
/opt/oracle/app/oradata/orcl/sysaux01.dbf									SYSAUX
/opt/oracle/app/oradata/orcl/system01.dbf									SYSTEM
/opt/oracle/app/oradata/orcl/example01.dbf									EXAMPLE
/opt/oracle/app/oradata/orcl/ts_seckeymng_admin.dbf								TS_SECKEY_ADMIN

6rowsselected.

创建表空间

CREATETABLESPACEts_seckey_admin
LOGGING
DATAFILE'/opt/oracle/app/oradata/orcl/ts_seckeymng_admin.dbf'SIZE50M
EXTENTMANAGEMENTLOCAL;


CREATETABLESPACEts_seckey_op
LOGGING
DATAFILE'/opt/oracle/app/oradata/orcl/ts_seckeymng_op.dbf'SIZE200M
EXTENTMANAGEMENTLOCAL;
ALTERDATABASEDATAFILE'/opt/oracle/app/oradata/orcl/ts_seckeymng_admin.dbf'AUTOEXTENDONNEXT50MMAXSIZEUNLIMITED;
ALTERDATABASEDATAFILE'/opt/oracle/app/oradata/orcl/ts_seckeymng_op.dbf'AUTOEXTENDONNEXT200MMAXSIZEUNLIMITED;

删除表空间

sql>DROPTABLESPACEts_seckey_adminINCLUDINGCONTENTSANDDATAFILES;
sql>DROPTABLESPACEts_seckey_opINCLUDINGCONTENTSANDDATAFILES;

查看表所在的表空间

selecttable_name,tablespace_namefromall_tables/dba_tables/user_tables;

删除用户

dropuseruser_namecascade;

创建用户

CREATEUSERuser_namePROFILEDEFAULT
IDENTIFIEDBYSECMNGDEFAULTTABLESPACEUSERS
ACCOUNTUNLOCK;

创建新用户方案SECMNGUSER1

CREATEUSER"SECMNGADMIN"PROFILE"DEFAULT"IDENTIFIEDBY"123456"DEFAULTTABLESPACE"USERS"ACCOUNTUNLOCK;
GRANT"CONNECT"TO"SECMNGADMIN";
GRANTSELECTANYTABLETO"SECMNGADMIN";

GRANTresourceTOSECMNGADMIN;
GRANTcreatesessionTOSECMNGADMIN;

授权:

GRANTDELETEONSECMNG.SRVCFGTO"SECMNGADMIN";
GRANTINSERTONSECMNG.SRVCFGTO"SECMNGADMIN";
GRANTUPDATEONSECMNG.SRVCFGTO"SECMNGADMIN";
原文链接:https://www.f2er.com/oracle/212795.html

猜你在找的Oracle相关文章