当前位置:网站首页>Common Oracle commands
Common Oracle commands
2022-07-06 14:48:00 【CS gun King】
1)oracle Backup data a user
( Not in sqlplus, It is executed in the operating system ,cmd etc. , need dba jurisdiction )
expdp tempuser/oracle DUMPFILE=suncrs20170105.DMP DIRECTORY=EXPDP_DIR1 SCHEMAS=suncrs logfile=suncrs20170105.dmp.log REUSE_DUMPFILES=Y
Be careful not to add the real example name , The real example name is wrong : And linux Need to be in oracle Execute under the installation user
2) Restore table data
Flashback ( Flashback query requires rollback segment support , Can query the front image of data . But when the rollback segment size is not enough , The old data will be covered , So what can flashback is a time range , It is impossible to do it at any time )
a) If you enable flashback, you can use the flashback table .
select log_mode,flashback_on from v$database;
If it is the following result, it will flash back
LOG_MODE FLASHBACK_ON
alter table Table name enable row movement; -- Enable table row movement
flashback table Table name to timestamp to_timestamp(‘20130813 14:00:00’,‘yyyymmdd hh24:mi:ss’);
b) Flashback query :
select *
from test_tmp as of timestamp to_timestamp(‘2014-05-28 11:00:00’,‘yyyy-mm-dd hh24:mi:ss’); Back to 2014 year 05 month 28 Japan 11 spot
c) Delete data table by mistake , Use the recycle bin to recover
SELECT * FROM user_recyclebin WHERE original_name=‘drop_test’;
FLASHBACK TABLE drop_test TO BEFORE DROP;
– Rename the table when recovering from the recycle bin ( Keep watch A Rename the recovery table B
flashback table surface A to before drop rename to surface B;)
purge table Table name ;– Delete the table specified in the recycle bin
purge recyclebin;– Empty your Recycle Bin . Pay attention to the operation , Don't empty it easily
drop table Table name purge;– Delete your table and no longer leave any traces in the recycle bin
3) Delete duplicate data : utilize rowid Realization
eg: delete FROM hdm.dtmg_data_exrt a
WHERE ROWID NOT IN (SELECT MAX(b.rowid)
FROM hdm.dtmg_data_exrt b
WHERE a.crcycd = b.crcycd
AND a.torycd = b.torycd
AND a.etl_dt = b.etl_dt);
4) One query record changes to multiple display , utilize rownum Realization ( Repeat display )
SELECT t.* FROM ca_bat_task t, (SELECT rownum FROM ca_bat_task where rownum between 1 and 2) t2
where t.shortname=‘BDSS’ ORDER BY TASK_CODE ASC;
5) View locked session( need sys jurisdiction )
View locked session,
SELECT OBJECT_NAME,MACHINE,S.SID,S.SERIAL# FROM V L O C K E D O B J E C T L , D B A O B J E C T S O , V LOCKED_OBJECT L,DBA_OBJECTS O, V LOCKEDOBJECTL,DBAOBJECTSO,VSESSION S WHERE L.OBJECT_ID=O.OBJECT_ID AND L.SESSION_ID=S.SID;
Kill session;
ALTER SYSTEM KILL SESSION ‘100,17235’;
ALTER SYSTEM disconnect SESSION ‘1264,32387’ immediate;
6) See the failed index , And rebuild (DROP PARTITION The post index will be invalid )
SELECT INDEX_NAME,STATUS FROM USER_INDEXES WHERE STATUS=‘UNUSABLE’;
ALTER INDEX INDEX_NAME REBUILD;
边栏推荐
- Pointeurs: maximum, minimum et moyenne
- 关于交换a和b的值的四种方法
- 后台登录系统,JDBC连接数据库,做小案例练习
- How to test whether an object is a proxy- How to test if an object is a Proxy?
- 【指针】统计一字符串在另一个字符串中出现的次数
- Keil5-MDK的格式化代码工具及添加快捷方式
- 数字电路基础(一)数制与码制
- 线程的实现方式总结
- 《统计学》第八版贾俊平第一章课后习题及答案总结
- Realize applet payment function with applet cloud development (including source code)
猜你喜欢
Statistics, 8th Edition, Jia Junping, Chapter 6 Summary of knowledge points of statistics and sampling distribution and answers to exercises after class
Harmonyos application development -- address book management system telmanagesys based on listcontainer [phonebook][api v6]
ES全文索引
5分钟掌握机器学习鸢尾花逻辑回归分类
servlet中 servlet context与 session与 request三个对象的常用方法和存放数据的作用域。
关于交换a和b的值的四种方法
Mysql的事务是什么?什么是脏读,什么是幻读?不可重复读?
Constants, variables, and operators of SystemVerilog usage
How to earn the first pot of gold in CSDN (we are all creators)
1.支付系统
随机推荐
Function: find 1-1/2+1/3-1/4+1/5-1/6+1/7-... +1/n
Statistics 8th Edition Jia Junping Chapter 5 probability and probability distribution
Fundamentals of digital circuits (III) encoder and decoder
1. Payment system
Function: find the maximum common divisor and the minimum common multiple of two positive numbers
王爽汇编语言学习详细笔记一:基础知识
浙大版《C语言程序设计实验与习题指导(第3版)》题目集
函数:字符串反序存放
“人生若只如初见”——RISC-V
《统计学》第八版贾俊平第十一章一元线性回归知识点总结及课后习题答案
XSS (cross site scripting attack) for security interview
Fundamentals of digital circuits (I) number system and code system
【指针】八进制转换为十进制
What level do 18K test engineers want? Take a look at the interview experience of a 26 year old test engineer
Statistics 8th Edition Jia Junping Chapter 3 after class exercises and answer summary
Overview of LNMP architecture and construction of related services
Harmonyos application development -- address book management system telmanagesys based on listcontainer [phonebook][api v6]
5分钟掌握机器学习鸢尾花逻辑回归分类
Keil5 MDK's formatting code tool and adding shortcuts
[issue 18] share a Netease go experience