<insert id="add" parameterType="list">
insert all into APP_ROLE_VS_JURISDICTION values
<foreach collection="list" index="index" item="ta" separator="into APP_ROLE_VS_JURISDICTION values" close="select 1 from dual" >
(#{ta.role_id},#{ta.jurisdiction_id})
</foreach>
</insert>
alter table sys_user enable row movement;--设置表权限
flashback table sys_user to timestamp to_date('2018-09-03 10:02:55','YYYY-MM-DD HH24:MI:SS');
--删除表
drop table tablename
--清空表
truncate table tablename
--查询生成,清空所有表的sql
SELECT 'TRUNCATE TABLE '|| table_name || ';' FROM USER_TABLES ORDER BY TABLE_NAME;
alter system set deferred_segment_creation=false
alter table 'sys_user' allocate extent;
批量生成sql:
select 'alter table '|| table_name || ' allocate extent;' from user_tables where segment_created='NO';
SELECT connect_by_isleaf as "hasChild", t.* FROM REVIEW_CONTENT t where t.PARENT_ID = #{contentParentId} --这里是正常的查询语句,其中connect_by_isleaf用户判断该记录时候有递归的子集
START WITH t.PARENT_ID = #{contentParentId} --指定开始递归的条件
CONNECT BY PRIOR t.ID = t.PARENT_ID --递归的条件
ORDER BY ORDER_NO
alter user child account unlock;--用户名
--查看被锁的表
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;
--查看那个用户那个进程照成死锁
select b.username,b.sid,b.serial#,logon_time from v$locked_object a,v$session b where a.session_id = b.sid order by b.logon_time;
--查看连接的进程
SELECT sid, serial#, username, osuser FROM v$session;
--查出锁定表的sid, serial#,os_user_name, machine_name, terminal,锁的type,mode
SELECT s.sid, s.serial#, s.username, s.schemaname, s.osuser, s.process, s.machine,
s.terminal, s.logon_time, l.type
FROM v$session s, v$lock l
WHERE s.sid = l.sid
AND s.username IS NOT NULL
ORDER BY sid;
这个语句将查找到数据库中所有的DML语句产生的锁,还可以发现,任何DML语句其实产生了两个锁,一个是表锁,一个是行锁。
--杀掉进程 sid,serial#
alter system kill session'210,11562';--对应的为sid和serial的值
1.实例数据全部导出
exp username/password@192.168.234.73/orcl file=d:/daochu/test.dmp full=y
2.导出用户数据
exp username/password@192.168.234.73/orcl file=d:/daochu/test.dmp owner=(user1,user2) --导出用户user1,和用户user2的数据
3.导出指定表数据
exp username/password@192.168.234.73/orcl file=d:/daochu/test.dmp tables=(t_user,t_role)
CREATE [UNIQUE | BITMAP] -- unique:唯一索引; 不写:默认为b树索引,适合列基本不一样的列; BITMAP:位图索引,适合重复值多的列,(如全是男女)
INDEX index_name --index_name 表示索引名称
ON table_name('column1' [ASC|DESC],'column2' ...) --table_name:表示表名, column1:表示字段名,可以多个
例:创建一个位图索引,名为index_sno,对应student表的sno字段
create bitmap index index_sno on student('sno');