数据库
vernonchen163
这个作者很懒,什么都没留下…
展开
-
oracle表空间管理
--查看修改ORACLE表空间--1、查看所有表空间信息select a.tablespace_name ,round(a.bytes_alloc / 1024 / 1024, 2) megs_alloc ,round(nvl(b.bytes_free, 0) / 1024 / 1024, 2) megs_free ,round((a.bytes_...原创 2014-04-24 11:15:46 · 120 阅读 · 0 评论 -
ORACLE查看并修改最大连接数
ORACLE查看并修改最大连接数第一步,在cmd命令行,输入sqlplus第二步,根据提示输入用户名与密码1. 查看processes和sessions参数 SQL> show parameter processes NAME TYPE VALUE db_writer...原创 2014-03-26 13:52:15 · 89 阅读 · 0 评论 -
oracle系统视图
--oracle树查询select * from FUNC T WHERE T.URL = 'examRoom/initExamRoomTicketList';SELECT * FROM FUNC START WITH FUNC_ID = '13-02-03-01'CONNECT BY PRIOR FUNC_ID = PARENT_ID;SELECT * FROM ...原创 2014-03-26 09:29:07 · 60 阅读 · 0 评论 -
数据库导入导出dump.txt
数据库导入导出dump原创 2014-07-28 10:26:59 · 195 阅读 · 0 评论 -
Oracle批量杀死锁.tst
declare cursor mycur is select s.sid ,s.serial# from v$session s ,v$lock l ,dba_objects o where l.sid = s.sid and l.id1 = o.object_...原创 2014-03-03 16:45:28 · 144 阅读 · 0 评论 -
Oracle批量杀死锁.sql
declare cursor mycur is select s.sid, s.serial# from v$session s, v$lock l, dba_objects o where l.sid = s.sid and l.id1 = o.object_id(+) and o.object_name = 'table...原创 2014-03-03 16:43:47 · 350 阅读 · 0 评论 -
ORACLE表空间管理维护
[url]http://www.cnblogs.com/kerrycode/p/3418694.html[/url]原创 2015-01-22 11:34:08 · 87 阅读 · 0 评论 -
自写函数用于替换wm_concat函数.zip
-- wm_concat出现在oracle10g版本中,不仅是加密的,而且是在一个单独的用户中,不方便使用。并且10g以前的版本也用不上。经过破解移植,可以方便大家使用-- 将下边的一个type,一个函数的创建脚本执行,就可以构建自己的wm_concat(这里叫zh_concat)。使用方法同wm_concat:-- type:create or replace TYPE ...原创 2015-01-19 16:25:43 · 237 阅读 · 0 评论 -
禁用启用所有外键约束.tst
禁用所有外键约束.tstdeclare cursor c1 is select t.table_name ,t.constraint_name from user_constraints t where t.owner = 'EMS3' AND T.constraint_type = 'R'; stmt va...原创 2015-01-12 11:05:08 · 153 阅读 · 0 评论 -
oracle查询生成列别名
select ',' ,col.COLUMN_NAME ,' as ' ,LOWER(substr(REPLACE(INITCAP(col.COLUMN_NAME), '_', ''), 1, 1)) || substr(REPLACE(INITCAP(col.COLUMN_NAME), '_', ''), 2) from user_...原创 2015-01-06 15:00:36 · 690 阅读 · 0 评论 -
0001-Oracle-系统-视图
--oracle树查询select * from FUNC T WHERE T.URL = 'examRoom/initExamRoomTicketList';SELECT * FROM FUNC START WITH FUNC_ID = '13-02-03-01'CONNECT BY PRIOR FUNC_ID = PARENT_ID;SELECT * FROM ...原创 2014-03-29 09:59:34 · 64 阅读 · 0 评论 -
oracle获取过程的错误异常代码,错误,异常栈信息
得到oracle异常行号,代码,异常栈信息Sql代码 declare v_i number(10); begin select 10 into v_i from dual where 1=3; exception when others then dbms_output.put_line(dbms_utility.format_...原创 2014-08-22 15:19:25 · 511 阅读 · 0 评论 -
oracle sql替换指定范围的字符串
--oracle替换指定范围的字符串(范围4-6)select substr('123456789', 1, 3) || '***' || SUBSTR('123456789', 7) from dual;--结果:123***789原创 2015-06-18 17:49:16 · 1052 阅读 · 0 评论 -
连接到sqlplus
root/passwdsu - oraclesqlplus / as sysdba关闭db: shutdown immediate重启db :startup重启系统: reboot原创 2014-04-17 11:25:25 · 77 阅读 · 0 评论 -
oracle字符集修改 中文乱码
sqlplus / as sysdba;//操作系统用户认证模式sqlplus sys/admin as sysdba;//非操作系统用户认证模式1、查询oracle服务端字符集 select t.PARAMETER ,t.VALUE from nls_database_parameters t where t.PARAMETER in ('NLS_LA...原创 2015-03-30 15:06:41 · 499 阅读 · 0 评论 -
oracle exp/imp 导入/导出
exp usr1/pwd1@127.0.0.1/orcl file=d:/table_data.dmp log=d:/table_data.log owner=(usr1)imp usr2/pwd2@127.0.0.1/orcl file=d:/table_data.dmp log=d:/table_data.log fromuser=usr1 touser=usr2 ignore=n...原创 2013-10-25 15:58:21 · 66 阅读 · 0 评论 -
oracle exp 命令使用
==导出一个完整数据库[结构+数据]========exp system/password file=/u01/20101115.dmp log=/u01/20101115.log full=y==只导出数据库的结构而不导出里面的数据=====exp system/password file=/u01/20101115.dmp log=/u01/20101115.log full=y ...原创 2013-10-23 19:24:27 · 168 阅读 · 0 评论 -
oracle常用系统视图+导入导出
==导出一个完整数据库[结构+数据]========exp system/password file=/u01/20101115.dmp log=/u01/20101115.log full=y==只导出数据库的结构而不导出里面的数据=====exp system/password file=/u01/20101115.dmp log=/u01/20101115.log full=...原创 2013-10-23 19:23:38 · 1455 阅读 · 0 评论 -
oracle表关联层级树查询
select level ,lpad(' ', (level - 1) * 20, ' ') || t.fk_table as node_name --节点名称(带缩进) ,t.fk_name ,t.fk_table ,t.pk_name ,t.pk_table from (select null as...原创 2015-03-20 17:27:27 · 473 阅读 · 0 评论 -
转:oracle层次查询 树查询 (详细)
oracle层次查询转自:http://www.2cto.com/database/201209/156398.html2012-09-20 0 个评论 作者:linwaterbin收藏 我要投稿 1 定义: 层次查询使用树的遍历,走遍含树形结构的数据集合,来获取树的层次关系报表的方法 ...原创 2015-03-20 15:03:26 · 492 阅读 · 0 评论 -
oracle删除重复记录
delete from cred_account ca1 where rowid < (select max(ca2.rowid) from cred_account ca2 where ca1.certi_type_id = ca2.certi_type_id and ca1.c...原创 2014-08-22 15:49:22 · 61 阅读 · 0 评论 -
linux下重启oracle
oracle/oracle连接ssh后登录数据库 sqlplus / as sysdba关闭数据库 shutdown immediate开启数据库 startup退出数据库 exitoracle监听器命令 查看:lsnrctl status [监听器名称,如:LISTENER2] 启动:lsnrctl st...原创 2015-01-05 15:44:48 · 104 阅读 · 0 评论 -
oracle约束、表和列名之间的查询-2
--查看约束信息select UC_1.TABLE_NAME as 从表名称 ,UC_1.CONSTRAINT_NAME as 从表约束名称 ,UC_1.CONSTRAINT_TYPE as 从表约束类型 ,UCC_1.column_name as 从表约束列名称 ,UC_2.TABLE_NAME as 主表名...原创 2013-09-03 15:57:14 · 83 阅读 · 0 评论 -
oracle约束、表和列名之间的查询-1
oracle约束、表和列名之间的查询SELECT USER_CONS_COLUMNS.CONSTRAINT_NAME AS 约束名, USER_CONS_COLUMNS.TABLE_NAME AS 表名, USER_CONS_COLUMNS.COLUMN_NAME AS 列名, USER_CONS_COLUMNS.POSITION AS 位置 FROM ...原创 2013-09-03 15:56:17 · 75 阅读 · 0 评论 -
oracle 批量杀死锁
declare cursor mycur is select s.sid ,s.serial# from v$session s ,v$lock l ,dba_objects o where l.sid = s.sid and l.id1 = o.object_...原创 2013-07-09 14:54:21 · 240 阅读 · 0 评论 -
Oracle 查询出现最多次的列
方法1.select * from exam_audit ea where (ea.exam_id, ea.type) = (select t1.exam_id, t1.type from (select t.exam_id, t.type, count(1) as cnt from exam_audit t...原创 2013-07-08 14:15:19 · 207 阅读 · 0 评论 -
oracle禁用外键后清空所有表数据
declare --所有外键约束 cursor c1 is select t.table_name ,t.constraint_name from user_constraints t where t.owner = 'IVM' AND T.constraint_type = 'R'; --所有业务表 ...原创 2013-11-28 13:54:38 · 310 阅读 · 0 评论 -
oracle 表类型 表变量
declare type my_emp is table of scott.emp%rowtype index by binary_integer; new_emp my_emp; v_num number := 0; cursor cur_emp is select empno, ename, job, sal from scott.emp;begin...原创 2013-07-04 10:01:45 · 267 阅读 · 0 评论 -
oracle的scott用户下默认表
oracle的scott用户下默认表2013-03-27 09:05:47 我来说两句 来源:xuan_xinya的专栏 收藏 我要投稿oracle的scott用户下默认表 EMP(雇员表)NO 字段 类型 描述1 ...原创 2013-07-04 09:59:30 · 126 阅读 · 0 评论 -
oracle 表类型变量的使用
oracle 表类型变量的使用使用记录类型变量只能保存一行数据,这限制了SELECT语句的返回行数,如果SELECT语句返回多行就会错。Oracle提供了另外一种自定义类型,也就是表类型,它是对记录类型的扩展,允许处理多行数据,类似于表。创建表类型的语法如下:TYPE table_name IS TABLE OF data_type [ NOT NULL ]INDEX BY BIN...原创 2013-07-04 09:54:16 · 182 阅读 · 0 评论 -
数据迁移详解
查找用户下所有空表并分配空间_解决不能导入exp空表 declare cursor c1 is select 'alter table ' || table_name || ' allocate extent' as xxx from user_tables where num_rows = 0; stmt varchar2(4000);begin for...原创 2013-11-16 10:00:36 · 202 阅读 · 0 评论 -
oralce 数据还原
select * from table1 as of timestamp to_timestamp('20130621 12:08:01', 'yyyymmdd HH24:MI:SS');update set_apply_exam sae set sae.item_name = (select t1.item_name from se...原创 2013-06-21 15:39:44 · 52 阅读 · 0 评论 -
删除用户下所有对象oracle
删除用户下所有对象oracle原创 2013-11-06 09:07:15 · 99 阅读 · 0 评论 -
oracle 空串 比较
declare len_x integer; len_y integer;begin select nvl(length(trim('')), 0) into len_x from dual; select nvl(length(trim(null)), 0) into len_y from dual; dbms_output.put_line...原创 2013-07-10 16:22:31 · 161 阅读 · 0 评论 -
oracle.sql.Clob类型转换成String类型
// oracle.sql.Clob类型转换成String类型 public static String clobToString( Clob clob) { String reString = ""; Reader is = null; try { is = clob.getCharacterStream(); } catch (SQLExcept...原创 2013-07-10 19:33:04 · 727 阅读 · 0 评论 -
oracle从分组中找出某个值,分组中是否包含某个值
SELECT MIN(created_timestamp), MAX(resource_id), MAX(price), MIN(CASE WHEN event_type IN (1704, 1701, 1703) THEN found_value WHEN event_type = 1...原创 2013-08-15 15:33:11 · 1977 阅读 · 0 评论 -
oracle查看表空间使用情况
select b.file_name 物理文件名 ,b.tablespace_name 表空间 ,b.bytes / 1024 / 1024 大小M ,(b.bytes - sum(nvl(a.bytes, 0))) / 1024 / 1024 已使用M ,substr((b.bytes - sum(nvl(a.bytes, 0))) / (...原创 2013-12-11 15:19:55 · 70 阅读 · 0 评论 -
oracle where case when where后面跟case when
where case when where后面跟case when原创 2013-07-16 18:59:32 · 2045 阅读 · 0 评论 -
详解Oracle多种表连接方式
详解Oracle多种表连接方式本文将介绍的是Oracle数据库中的多种表连接方式,包括内连接、外连接、自连接等等。希望对大家有所帮助。1. 内连接(自然连接)2. 外连接(1)左外连接 (左边的表不加限制)(2)右外连接(右边的表不加限制)(3)全外连接(左右两表都不加限制)3. 自连接(同一张表内的连接)SQL的标准语法:s...原创 2013-07-15 18:55:08 · 68 阅读 · 0 评论 -
Oracle查出所有主表或从表
--查出所有从表select/*+ INDEX(sys.con$,I_CON1) */ OWNER,CONSTRAINT_NAME,CONSTRAINT_TYPE,TABLE_NAME,R_OWNER,R_CONSTRAINT_NAME from ALL_CONSTRAINTS T where T.OWNER = SYS.LOGIN_USER ...原创 2013-11-30 10:22:06 · 364 阅读 · 0 评论