当前位置:网站首页>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;
边栏推荐
- 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
- [pointer] counts the number of times one string appears in another string
- Uibutton status exploration and customization
- JDBC read this article is enough
- flask实现强制登陆
- Pointer -- eliminate all numbers in the string
- 数字电路基础(四) 数据分配器、数据选择器和数值比较器
- c语言学习总结(上)(更新中)
- [pointer] the array is stored in reverse order and output
- Database monitoring SQL execution
猜你喜欢

ES全文索引

Statistics 8th Edition Jia Junping Chapter 12 summary of knowledge points of multiple linear regression and answers to exercises after class

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

Interview Essentials: what is the mysterious framework asking?

Wang Shuang's detailed learning notes of assembly language II: registers

Binary search tree concept

Wang Shuang's detailed notes on assembly language learning I: basic knowledge

Fundamentals of digital circuits (II) logic algebra

Fundamentals of digital circuit (V) arithmetic operation circuit
![Transplant hummingbird e203 core to Da Vinci pro35t [Jichuang xinlai risc-v Cup] (I)](/img/85/d6b196f22b60ad5003f73eb8d8a908.png)
Transplant hummingbird e203 core to Da Vinci pro35t [Jichuang xinlai risc-v Cup] (I)
随机推荐
Wang Shuang's detailed learning notes of assembly language II: registers
王爽汇编语言详细学习笔记二:寄存器
函数:用牛顿迭代法求方程的根
XSS (cross site scripting attack) for security interview
【指针】使用插入排序法将n个数从小到大进行排列
Keil5-MDK的格式化代码工具及添加快捷方式
What level do 18K test engineers want? Take a look at the interview experience of a 26 year old test engineer
《统计学》第八版贾俊平第十二章多元线性回归知识点总结及课后习题答案
[issue 18] share a Netease go experience
MySQL interview questions (4)
What is an index in MySQL? What kinds of indexes are commonly used? Under what circumstances will the index fail?
Four methods of exchanging the values of a and B
Statistics 8th Edition Jia Junping Chapter XIII Summary of knowledge points of time series analysis and prediction and answers to exercises after class
With 27K successful entry ByteDance, this "software testing interview notes" has benefited me for life
Solutions to common problems in database development such as MySQL
Software testing interview summary - common interview questions
Pointer -- output all characters in the string in reverse order
Fundamentals of digital circuit (V) arithmetic operation circuit
c语言学习总结(上)(更新中)
Cadence physical library lef file syntax learning [continuous update]