当前位置:网站首页>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;
边栏推荐
- Mysql的事务是什么?什么是脏读,什么是幻读?不可重复读?
- XSS (cross site scripting attack) for security interview
- 指针:最大值、最小值和平均值
- 《统计学》第八版贾俊平第四章总结及课后习题答案
- Statistics 8th Edition Jia Junping Chapter 7 Summary of knowledge points and answers to exercises after class
- {1,2,3,2,5} duplicate checking problem
- 浙大版《C语言程序设计实验与习题指导(第3版)》题目集
- Es full text index
- Statistics 8th Edition Jia Junping Chapter 2 after class exercises and answer summary
- 【指针】求二维数组中最大元素的值
猜你喜欢

《统计学》第八版贾俊平第十二章多元线性回归知识点总结及课后习题答案

《统计学》第八版贾俊平第九章分类数据分析知识点总结及课后习题答案

Statistics 8th Edition Jia Junping Chapter XIII Summary of knowledge points of time series analysis and prediction and answers to exercises after class

移植蜂鸟E203内核至达芬奇pro35T【集创芯来RISC-V杯】(一)

Wu Enda's latest interview! Data centric reasons

《统计学》第八版贾俊平第十一章一元线性回归知识点总结及课后习题答案

内网渗透之内网信息收集(三)

Statistics 8th Edition Jia Junping Chapter 14 summary of index knowledge points and answers to exercises after class

数字电路基础(三)编码器和译码器

5 minutes to master machine learning iris logical regression classification
随机推荐
四元数---基本概念(转载)
Realize applet payment function with applet cloud development (including source code)
《统计学》第八版贾俊平第八章假设检验知识点总结及课后习题答案
JDBC 的四种连接方式 直接上代码
Function: find the root of the equation by Newton iterative method
【指针】统计一字符串在另一个字符串中出现的次数
Pointers: maximum, minimum, and average
[issue 18] share a Netease go experience
Statistics 8th Edition Jia Junping Chapter 7 Summary of knowledge points and answers to exercises after class
内网渗透之内网信息收集(三)
Function: find 1-1/2+1/3-1/4+1/5-1/6+1/7-... +1/n
王爽汇编语言学习详细笔记一:基础知识
ByteDance ten years of experience, old bird, took more than half a year to sort out the software test interview questions
Cadence physical library lef file syntax learning [continuous update]
函数:求两个正数的最大公约数和最小公倍
函数:求1-1/2+1/3-1/4+1/5-1/6+1/7-…+1/n
Sword finger offer 23 - print binary tree from top to bottom
Statistics 8th Edition Jia Junping Chapter 5 probability and probability distribution
【指针】数组逆序重新存放后并输出
Solutions to common problems in database development such as MySQL