SELECT * FROM (SELECT a.*, ROWNUM rn FROM (SELECT * FROM tablename) a WHERE ROWNUM <= 40) WHERE rn >= 21
SELECT TABLE_NAME,COLUMN_NAME FROM USER_TAB_COLUMNS WHERE upper(COLUMN_NAME) like '%ull%'
SELECT dob.OBJECT_NAME Table_Name,lo.SESSION_ID||', '||vss.SERIAL# 删除号,
lo.locked_mode,lo.SESSION_ID, vss.SERIAL#,vss.action Action,vss.osuser OSUSER, vss.LOGON_TIME,
vss.process AP_PID, VPS.SPID DB_PID ,vss.*
From v$locked_object lo, dba_objects dob, v$session vss, V$PROCESS VPS
Where lo.OBJECT_ID = dob.OBJECT_ID
alter system kill session '173, 19819';
3 、在/home/oracle/oradata 目录下新建一个文件夹,后面创建表空间需要用到
cd /home/oracle/app/oracle/oradata/gaosu
create temporary tablespace gaosutyrz_temp
tempfile '/home/oracle/app/oracle/oradata/gaosu/gaosutyrz_temp.dbf'
datafile '/home/oracle/app/oracle/oradata/gaosu/gaosutyrz_data.dbf'
create user gaosutyrz identified by gaosutyrz
temporary tablespace gaosutyrz_temp;
grant connect,resource,dba to gaosutyrz;
exp NAUTHU/NAUTHU@10.125.3.240/sspccsm file=/home/oracle/NAUTHU_20170829.dmp owner= NAUTHU consistent=y direct=y log=/home/oracle/NAUTHU_20170829.log
exp partition/partition@192.128.2.68/orcl tables=(T_ATTRECODE_REPORT) file=C:\Users\Administrator\Desktop\123.dmp
1. create directory expdp_dir as '/home/oracle/fmt';
2. expdp username/pwd directory=expdp_dir logfile=test.log schemas=username
(expdp test_c/test_c directory=temp1 logfile=test.log version=10.2.0.1.0)
1.imp(表空间,tablespace需要和dump文件中的一致,如果不一致,需要改dump文件中的tablespace)
imp th_livebos/th_livebos@10.125.3.240/sspccsm full=y file=/home/oracle/NACCOUNTU_20170829.dmp ignore=y;
imp spot/spot@192.128.1.6/chenn file="d:\student.dmp" full=y ignore=y
imp partition/partition@192.128.2.68/orcl file=C:\Users\Administrator\Desktop\123.dmp tables=(t_attrecode_report) ignore=yes
1. create directory expnc_dir as '/home/oracle/fmt';
2. impdp oaold/oaold directory=expnc_dir dumpfile=livebos20180314.dmp remap_schema=livebos:oaold remap_tablespace=livebos:oaold EXCLUDE=STATISTICS TRANSFORM=OID:n
(从原来的livebos用户→oaold用户;从原来的livebos表空间→oaold表空间)
create table tablename as select * from table where id=-1
insert into 目标表 select * from 原表;
ORA-01940: cannot drop a user that is currently connected
(查看被占用进程)select username,sid,serial# from v$session where username='OAOLD';
(查看被占用进程状态)select saddr,sid,serial#,paddr,username,status from v$session where username ='OAOLD';
(杀死占用进程) alter system kill session '224,15140';
drop tablespace oaold including contents and datafiles;
select username,default_tablespace from dba_users where username='OAOLD'
13.字符集导致 ORA-00957: duplicate column name
$ export nls_lang=AMERICAN_AMERICA.ZHS16GBK
SQL>select username,default_tablespace from user_users;
SQL>select * from user_role_privs;
SQL>select * from user_sys_privs;
SQL>select * from user_tab_privs;
SQL>select * from session_privs;
SQL>select * from dba_sys_privs where grantee='GAME';
SQL>select * from user_tables;
SQL>select object_name,created from user_objects where object_name=upper('&table_name');
SQL>select sum(bytes)/(1024*1024) as "size(M)" from user_segments where segment_name=upper('&table_name');
SQL>select table_name,cache from user_tables where instr(cache,'Y')>0;
SQL>select * from user_sequences;
SQL>select view_name from user_views;
25.1 增加字段语法:alter table tablename add (column datatype [default value][null/not null],….);
说明:alter table 表名 add (字段名 字段类型 默认值 是否为空);
例:alter table sf_users add (HeadPIC blob);
例:alter table sf_users add (userName varchar2(30) default '空' not null);
25.2 修改字段的语法:alter table tablename modify (column datatype [default value][null/not null],….);
说明:alter table 表名 modify (字段名 字段类型 默认值 是否为空);
例:alter table sf_InvoiceApply modify (BILLCODE number(4));
25.3 删除字段的语法:alter table tablename drop (column);
说明:alter table 表名 drop column 字段名;
例:alter table sf_users drop column HeadPIC;
说明:alter table 表名 rename column 列名 to 新列名 (其中:column是关键字)
例:alter table sf_InvoiceApply rename column PIC to NEWPIC;
说明:alter table 表名 rename to 新表名
例:alter table sf_InvoiceApply rename to sf_New_InvoiceApply;
create or replace view viewname as select 字段列表 from 表1 inner join 表2 on 表1.字段 = 表2.字段 where 条件;
ALTER TABLE tableName modify(columnName 类型);
ID VARCHAR2(40 CHAR) not null,
select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
select * from t_attache as of timestamp sysdate-20/1440;
insert into t_attache (select * from t_attache as of timestamp sysdate-20/1440 );
select pid from V_DATA_DICT connect by prior id=pId start with id = 'ec8b31c095bb4c5a8cd0f4df4963aec0'
exp cari_partition/cari_partition@orcl file='d:\t_resouseinfo.dmp' tables=t_resouseinfo query=\"where ORG_ID='ace6dba4d69246fcb72a19eb6687f5c7'\" indexes=n
imp test_p/test_p@orcl file='d:\t_resource.dmp' ignore=y full=y
https://blog.csdn.net/LIUHUA121/article/details/80050263
a9fe42b86e854918b9cd3e3fabbff35e:父节点id