日期:2014-05-16  浏览次数:20646 次

Oracle烂笔头
sqlplus sys/manager as sysdba
connect sys/manager as sysdba


su - oracle
sqlplus system/manage@EMINCOM
--导出用户sop6下的所有数据
!exp sop6/sop6@EMINCOM file=sop6.dmp owner=sop6


Grant分配访问权限
grant select on ICDETAILS to PEOPLEHUB
grant insert on ICDETAILS to PEOPLEHUB
grant all on ICDETAILS to PEOPLEHUB
grant all on icdetails to PUBLIC



行号的使用
SELECT ROWID,A.* FROM CARDISSUES A;
SELECT ROWNUM,A.* FROM CARDISSUES A;
SELECT * FROM CARDISSUES A WHERE ROWNUM<100



DROP USER SOP6_BLS CASCADE;
DROP USER BBLSAPP CASCADE;
DROP USER SOP_ERS_BLS CASCADE;


select username,user_id,account_status,default_tablespace,temporary_tablespace from dba_users where username='SOP6_BLS';
select username,user_id,account_status,default_tablespace,temporary_tablespace from dba_users where username='BBLSAPP'
select username,user_id,account_status,default_tablespace,temporary_tablespace from dba_users where username='SOP_ERS_BLS'

DROP TABLESPACE SOP;
DROP TABLESPACE SOP_TMP;


CREATE TABLESPACE SOP  
logging datafile '/u01/app/oracle/product/9.2.0/dbs/sop.dbf' 
size 50m  
autoextend on  
NEXT 50m MAXSIZE 2048m  
EXTENT MANAGEMENT LOCAL;

CREATE TEMPORARY TABLESPACE SOP_TMP tempfile '/u01/app/oracle/product  /9.2.0/dbs/sop_temp.dbf' size 50m AUTOEXTEND ON NEXT 50m MAXSIZE 1024m extent management local;


CREATE USER SOP6_BLS IDENTIFIED BY password$1 DEFAULT TABLESPACE SOP
TEMPORARY TABLESPACE SOP_TMP;

CREATE USER BBLSAPP IDENTIFIED BY password$1 DEFAULT TABLESPACE SOP_ESS
TEMPORARY TABLESPACE SOP_ESSTMP;

CREATE USER SOP_ERS_BLS IDENTIFIED BY password$1 DEFAULT TABLESPACE SOP_ERS
TEMPORARY TABLESPACE SOP_ERSTMP;


GRANT RESOURCE,CONNECT,DBA TO SOP6_BLS;
GRANT RESOURCE,CONNECT,DBA TO BBLSAPP;
GRANT RESOURCE,CONNECT,DBA TO SOP_ERS_BLS;


--IMPORT DMP
$imp system file=D:\UATDump\tempcopy\sop6_bls_dev26052012.dmp log=sop6_imp.log fromuser=SOP6_BLS
$imp system file=D:\UATDump\tempcopy\bblsapp_dev26052012.dmp log=bblsapp_imp.log fromuser=BBLSAPP
$imp system file=D:\UATDump\tempcopy\sop_ers_bls_dev26052012.dmp log=sop_ers_imp.log fromuser=SOP_ERS_BLS

--Create synonym
CREATE SYNONYM BBLSAPP.COMMONS_SEQUENCE FOR SOP6.COMMONS_SQUENCE;
--Remove synonym
DROP SYNONYM BBLSAPP.COMMONS_SEQUENCE;
--Search all synonyms
SELECT * FROM DBA_SYNONYMS;