select * from product_component_version;
查看当前用户所具有的权限:
SELECT * FROM DBA_SYS_PRIVS WHERE GRANTEE = 'KNMY';
或
select * from user_sys_privs;
[username/password] [@server] [as sysdba/sysoper] 举例:sys/pass as sysdba
用户的切换:
[connect][username/password] [@server] [as sysdba/sysoper] 举例: connect system/pass
show user
显示数据字典中的字段:
desc dba_users
desc table_spaces
desc user_tablespaces
desc user_users
desc dba_data_files
desc dba_temp_files
desc dba_role_privs
创建用户且指定表空间:
CREATEUSERusernameIDENTIFIEDBYpassword
DEFAULTTABLESPACETEST_DATA
TEMPORARYTABLESPACETEST_TEMP;
drop user ×× cascade;
给用户赋予权限:
GRANT
CREATESESSION,CREATEANYTABLE,CREATEANYVIEW,CREATEANYINDEX,
CREATEANYPROCEDURE,ALTERANYTABLE,ALTERANYPROCEDURE,
DROPANYTABLE,DROPANYVIEW,DROPANYINDEX,DROPANYPROCEDURE,
SELECTANYTABLE,INSERTANYTABLE,UPDATEANYTABLE,DELETEANYTABLE
TOusername;
将role这个角色授予username:
GRANTroleTOusername;
设置用户的默认或者临时表空间:
ALTER USER username DEFAULT|TEMPORARY TABLESPACE tablespace_name
创建表空间:
CREATE [TEMPORARY] TABLESPACE tablespace_name TEMPFILE|DATAFILE 'xx.dbf' SIZE xx;
举例:
创建临时表空间:
CREATETEMPORARYTABLESPACEtest_temp
TEMPFILE'D:\oracle\product\10.1.0\oradata\orcl\test_temp01.dbf'
SIZE32M
AUTOEXTENDON
NEXT32MMAXSIZE2048M
EXTENTMANAGEMENTLOCAL;
创建用户表空间:
CREATETABLESPACEtest_data
LOGGING
DATAFILE'D:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\TEST_DATA01.DBF'
SIZE32M
AUTOEXTENDON
NEXT32MMAXSIZE2048M
EXTENTMANAGEMENTLOCAL;
修改表空间的状态:
设置表空间的联机或者脱机状态:
ALTER TABLESPACE tablespace_name ONLINE|OFFLINE
设置表空间只读或者可读写状态:
ALTER TABLESPACE tablespace_name READ ONLY|READ WRITE
ALTER TABLESPACE tablespace_name ADD DATAFILE 'xx.dbf' SIZE xx
ALTER TABLESPACE tablespace_name DROP DATAFILE 'xx.dbf'
删除表空间:
DROPTABLESPACE tablespace_name [INCLUDING CONTENTS]
查看是否为CDB的数据库:
select * from v$database; 若CDB字段为YES,则是。
原文链接:https://www.f2er.com/oracle/208005.html