oracle运维命令大全,oracle维护常用命令收集

查询数据库表空间容量和数据量

SELECT a.tablespace_name ,

total,

free,

(total - free),

total / (1024 * 1024 * 1024) "TS(G)",

free / (1024 * 1024 * 1024) "TSfree(G)",

(total - free) / (1024 * 1024 * 1024) "TSuse(G)",

round((total - free) / total, 4) * 100 "BaiFenBi %"

FROM (SELECT tablespace_name, SUM(bytes) free

FROM dba_free_space

GROUP BY tablespace_name) a,

(SELECT tablespace_name, SUM(bytes) total

FROM dba_data_files

GROUP BY tablespace_name) b

WHERE a.tablespace_name = b.tablespace_name

ASMCMD查询存储使用情况

ls -s

lsdg

du

导出数据

create or replace directory data as '/home/oracle/imp'

Grant read,write on directory data to test1;

expdp test1/test1@pdborcl directory=data dumpfile=test1.dump logfile=test1.log schemas=test1

impdp test1/test1@pdborcl directory=data dumpfile=test1.dump logfile=test1.log tables=tab_t1

拼接sql语句

select 'select * from dba_tab_privs where grantee='|| username ||';' from dba_users;

select 'select * from dba_tab_privs where grantee='''||username||''';' from dba_users;

select 'insert into table_name values('''||field_1||''','''||field_2||''');'from table_name where field_n=some_conditon;

http://www.cppblog.com/fwxjj/archive/2011/10/17/158567.html

查询非系统用户

select username from dba_users where username not in

('SYS'

,'SYSTEM'

,'OUTLN'

,'FLOWS_FILES'

,'MDSYS'

,'ORDSYS'

,'EXFSYS'

,'DBSNMP'

,'WMSYS'

,'APPQOSSYS'

,'APEX_030200'

,'ORDDATA'

,'CTXSYS'

,'ANONYMOUS'

,'XDB'

,'ORDPLUGINS'

,'SI_INFORMTN_SCHEMA'

,'OLAPSYS'

,'ORACLE_OCM'

,'XS$NULL'

,'MDDATA'

,'DIP'

,'APEX_PUBLIC_USER'

,'SPATIAL_CSW_ADMIN_USR'

,'SPATIAL_WFS_ADMIN_USR');

把某用户的对象授权给另一用户及撤销

select 'grant all on A1.'||table_name||' to B1;' from dba_tables where owner='A1';

select 'revoke all on A1.'||table_name||'  from B1;' from dba_tables where owner='A1';

alter user A1 default_tablespace='B1';

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值