用dbc怎样打开数据库(打开数据库xs.dbc的命令是)

用dbc怎样打开数据库(打开数据库xs.dbc的命令是)登录高斯 ssh dbuser ip zsql sys password 127 0 0 1 port nbsp 登录所有 db for dbname in echo dblist do zsql db password dbname c select from table gt dbname info done nbsp 收集 awr wrs list wsr snapid snapid nbsp 导出表数据 dump



登录高斯

ssh dbuser@ip

zsql sys/password@127.0.0.1:port

 

登录所有db

for dbname in 'echo ${dblist}

do

zsql db/password@${dbname} -c "select * from table;" >${dbname}.info

done

 

收集awr

wrs list

wsr snapid snapid

 

导出表数据

dump QUERY "select * from table" into file 'test.csv' COLUMNS ENCLOSED BY '' COLUMNS TERMINATED BY '|';

dump TABLE tablename into file 'test.csv' COLUMNS BY '' COLUMNS TERMINATED BY '|';

 

导出表结构

exp tables=table1,table2 file='test.sql' content=metadata_only;

导出表数据

exp tables=table1,table2 file='test.sql' filetype=TXT content=data_only;

 

exp导出大量表

aaa.txt 里是表名列表 table1,table2

tablelist=$(cat aaa.txt)

zsql db/password@ip:port -c "exp tables=${tablelist} file="exp.txt"";

 

SQL

删除表

drop table tablename

删除记录

delete from tablename

清空表

truncate table tablename

备份表

creat table tt_bak as select * from tt

查询

select count(1),substr(col,-2),to_char(time,'YYYYMMDDHH24') from tblname group by substr(col,-2),to_char(time,'YYYYMMDDHH24') having count(1)>1000 order by to_char(time,'YYYYMMDDHH24');

 

 

函数

upper

to_date('2024/05/08','YYYY/MM/DD')

to_char(time,'YYYYMMDDHH24')

substr(val,-2)

 

查看数据库占用空间最大的20个表

select segment_name,q

segment_type,bytes from my_segments order by bytes desc limit 20;

 

索引空间回收

alter index indexname unusable

alter index indexname rebuild online

 

 

 

 

 

 

 

 

编程小号
上一篇 2025-04-21 19:51
下一篇 2025-03-10 14:57

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/bian-cheng-ri-ji/41788.html