一些让人忽略的oracle维护命令
对象权限 select owner, table_name, grantor, privilege, grantable, hierarchy, 'TABLE' /*o.*/ object_type from dba_tab_privs p where p.grantee = 'HR' order by p.owner, p.table_name; 角色 select granted_role, admin_option, default_role from d
对象权限
select owner,
table_name,
grantor,
privilege,
grantable,
hierarchy,
'TABLE' /*o.*/ object_type
from dba_tab_privs p
where p.grantee = 'HR'
order by p.owner, p.table_name;
角色
select granted_role, admin_option, default_role
from dba_role_privs
where grantee = 'HR'
order by granted_role;
系统权限
select privilege, admin_option
from dba_sys_privs
where grantee = 'HR'
order by privilege;
表空间限额
select * from dba_ts_quotas where username = 'SYSMAN' order by tablespace_name;
用户或系统角色对应的权限
select * from role_sys_privs where role = 'RESOURCE'
数据库所有的系统权限名称
select DISTINCT NAME from system_privilege_map t WHERE T.NAME LIKE '%SELECT%'
df -h 磁盘空间使用率
show parameter log_archive_format
查看用户的概要文件
select username, profile from dba_users where username='SCOTT';
查看相应概要文件的各项设置
select resource_name, limit from dba_profiles where profile = 'DEFAULT';
修改相应的概要文件选项
ALTER PROFILE "DEFAULT" LIMIT CONNECT_TIME 30; 最大连接时间30分钟
ALTER PROFILE "DEFAULT" LIMIT FAILED_LOGIN_ATTEMPTS 3; 最大登录尝试次数 3次
rman 启动自动备份控制文件功能
show all;
CONFIGURE CONTROLFILE AUTOBACKUP clear; #清除设置 恢复为默认值
configure controlfile autobackup on; #设置为自动备份控制文件
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 30 DAYS; #修改保留策略为保留30天
backup archivelog all; 备份归档日志
backup tablespace users; 备份users表空间
backup datafile 3; 备份数据文件
backup incremental level 0 database; 零级备份
backup incremental level 1 database; 一级差异增量
backup incremental level 1 cumulative database format '/oradata/bak/dblevel1.bak'; 一级累计增量
backup as compressed backupset datafile 4; 以压缩方式备份数据文件 4
归档空间满时的处理办法
rm *.arc 先用操作系统命令手工删除部分归档文件
rman target /
change archivelog all validate;
delete noprompt expired archivelog all;
RUN { EXECUTE SCRIPT b_whole_10; } 执行rman的脚本
,推荐阅读