当前位置:网站首页>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;
边栏推荐
- Intranet information collection of Intranet penetration (3)
- MySQL中什么是索引?常用的索引有哪些种类?索引在什么情况下会失效?
- Keil5-MDK的格式化代码工具及添加快捷方式
- Function: string storage in reverse order
- 《统计学》第八版贾俊平第五章概率与概率分布
- Wang Shuang's detailed learning notes of assembly language II: registers
- New version of postman flows [introductory teaching chapter 01 send request]
- Overview of LNMP architecture and construction of related services
- Fire! One day transferred to go engineer, not fire handstand sing Conquest (in serial)
- Pointeurs: maximum, minimum et moyenne
猜你喜欢
《统计学》第八版贾俊平第十四章指数知识点总结及课后习题答案
JDBC read this article is enough
线程的实现方式总结
1. Payment system
5 minutes to master machine learning iris logical regression classification
《统计学》第八版贾俊平第十三章时间序列分析和预测知识点总结及课后习题答案
About the garbled code problem of superstar script
《统计学》第八版贾俊平第五章概率与概率分布
Résumé des points de connaissance et des réponses aux exercices après la classe du chapitre 7 de Jia junping dans la huitième édition des statistiques
Markdown font color editing teaching
随机推荐
Intranet information collection of Intranet penetration (4)
Summary of thread implementation
[pointer] find the largest string
《统计学》第八版贾俊平第十二章多元线性回归知识点总结及课后习题答案
关于超星脚本出现乱码问题
[pointer] the array is stored in reverse order and output
《统计学》第八版贾俊平第五章概率与概率分布
Overview of LNMP architecture and construction of related services
函数:求两个正数的最大公约数和最小公倍
Fundamentals of digital circuit (IV) data distributor, data selector and numerical comparator
Pointer -- eliminate all numbers in the string
数字电路基础(五)算术运算电路
Statistics, 8th Edition, Jia Junping, Chapter 11 summary of knowledge points of univariate linear regression and answers to exercises after class
Statistics 8th Edition Jia Junping Chapter 2 after class exercises and answer summary
servlet中 servlet context与 session与 request三个对象的常用方法和存放数据的作用域。
数字电路基础(三)编码器和译码器
【指针】查找最大的字符串
[pointer] find the length of the string
【指针】数组逆序重新存放后并输出
Function: find the root of the equation by Newton iterative method