首页 > 代码库 > Oracle碎碎念
Oracle碎碎念
1. 设置SQL*Plus提示符
SQL> set sqlprompt "_user‘@‘_connect_identifier>"
SYS@orcl>
为了对所有的SQL*Plus会话自动设置sqlprompt,将上面的命令放置在ORACLE_HOME/sqlplus/admin目录中的glogin.sql文件内
2. 查看角色RESOURCE被授予的系统权限
SQL> select * from dba_sys_privs where grantee=‘RESOURCE‘;
GRANTEE PRIVILEGE ADM
------------------------------ --------------------------------------- ---
RESOURCE CREATE TRIGGER NO
RESOURCE CREATE SEQUENCE NO
RESOURCE CREATE TYPE NO
RESOURCE CREATE PROCEDURE NO
RESOURCE CREATE CLUSTER NO
RESOURCE CREATE OPERATOR NO
RESOURCE CREATE INDEXTYPE NO
RESOURCE CREATE TABLE NO
3. 查看系统timestamp
SQL> select systimestamp from dual;
4. 在Automatic Memory Management情况下查看pga和sga的大小
SQL> select sum(value) from v$sesstat natural join v$statname where name=‘session pga memory‘;
SQL> select sum(bytes) from v$sgastat;
5. 识别数据库中的所有无效对象
SQL> select owner,object_name,object_type from dba_objects where status=‘INVALID‘;