sql
Linux_痞子
痞子
展开
-
oracle 查询锁和解锁
1、查找锁表后台需要经常的数据库交互,有时需要查看一些操作不当导致数据库的一些表被锁住,这时就需要查找出哪些表被锁,进而解锁。 查看锁表进程SQL语句 select sess.sid, sess.serial#, lo.oracle_username, lo.os_user_name, ao.object_name, lo.loc翻译 2017-06-27 14:26:59 · 448 阅读 · 0 评论 -
Oracle 数据集
Oracle 在表与表之间取交集,差集关键字UNION, UNION ALL, INTERSECT, and MINUSYou can combine multiple queries using the set operators UNION, UNION ALL, INTERSECT, and MINUS. All set operators have equal preceden...转载 2018-02-08 14:46:49 · 1145 阅读 · 0 评论 -
oracle 最简导入导出数据
1、登陆终端 sqlplus / as sysdba grant dba to ystr32、创建用户,授权create user lnalims identified by lnalims;grant dba to lnalims;3、导入数据1、导入.dmp中的所有数据 imp user_name/password@ip/orcl ...原创 2017-10-26 10:12:33 · 294 阅读 · 0 评论 -
oracle 备份数据
oracle 经常需要的备份数据的操作1、如果表不存在create table new_table_name asselect column_name,[more columns] from Existed_table; 例如create table deptasselect empno, ename from emp;2、 如果表存在insert in...原创 2018-02-09 16:18:56 · 235 阅读 · 0 评论 -
oracle 重复数据去除
oracle 重复数据查重删除select idfrom (select row_number() over(partition by self_object_id order by self_object_id) record_line, si.* from sample_info si where self_object_id in原创 2018-02-05 13:19:18 · 393 阅读 · 0 评论 -
15 Things You Should Know about the ORDER BY Clause
When multiple columns/expressions are specified in the ORDER BY clause, the precedence of sorting is left to right.The ORDER BY clause can order in ascending (ASC) or descending (DESC) sequence, or ...转载 2018-02-09 14:26:24 · 343 阅读 · 0 评论 -
oracle snapshot
利用闪回查看Oracle表历史时刻数据1.查看表历史时刻数据select * from tab_test AS OF TIMESTAMP to_timestamp('20140917 10:00:00','yyyymmdd hh24:mi:ss'); 2、利用flashback table恢复表到过去某一时刻alter table tab_test enable row movement; flas翻译 2017-12-01 18:32:24 · 594 阅读 · 0 评论 -
oracle lock
查看哪个表被锁 select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects b where b.object_id = a.object_id; 查看是哪个session引起的 select b.username,b.sid,b.serial#,logon_翻译 2017-12-01 18:27:57 · 476 阅读 · 0 评论 -
postgresql zip install
1 Download the ZIP file from http://www.enterprisedb.com/products-services-training/pgbindownload2 Unzip the archive into a directory of your choice (the archive is created such that unzipping it, it w转载 2017-11-21 21:41:49 · 569 阅读 · 0 评论 -
Oracle:查找表的主键,外键,唯一性约束,索引
oracle:查找表的主键,外键,唯一性约束,索引1、查找表的所有索引(包括索引名,类型,构成列) select t.*, i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name翻译 2017-07-31 19:41:17 · 492 阅读 · 0 评论 -
Oracle 对时间的操作
早Oracle中对月份,毫秒,微秒的操作都有函数支持,但是对于天数,时分秒的操作却没有内置的函数支持,下面演示如何操作时分秒 In a more general way you can use “INTERVAL”. Here some examples: 1) 对当前时间加1天 select sysdate + INTERVAL ‘1’ DAY from dual; ...原创 2018-03-30 10:27:13 · 286 阅读 · 0 评论