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;
修改列类型
SET AUTOCOMMIT OFF;
--ADD TEMP COLUMN
ALTER TABLE POSTING_RESULT_DETAIL ADD PRS_SCHOOL_IDADD VARCHAR2(10);
UPDATE POSTING_RESULT_DETAIL SET PRS_SCHOOL_IDADD = PRD_SCHOOL_ID;
--GET PK
SELECT * FROM ALL_CONSTRAINTS WHERE UPPER(TABLE_NAME) like '%POSTING_RESULT_DETAIL%' AND CONSTRAINT_TYPE='P';
--REMOVE PK
ALTER TABLE PROJECT_S1_DEV.POSTING_RESULT_DETAIL DROP CONSTRAINT SYS_C0024916;
--DROP PRD_SCHOOL_ID
ALTER TABLE PROJECT_S1_DEV.POSTING_RESULT_DETAIL DROP COLUMN PRD_SCHOOL_ID;
--RENEW PRD_SCHOOL_ID
ALTER TABLE PROJECT_S1_DEV.POSTING_RESULT_DETAIL RENAME COLUMN PRS_SCHOOL_IDADD TO PRD_SCHOOL_ID;
--ADD PK
ALTER TABLE PROJECT_S1_DEV.POSTING_RESULT_DETAIL ADD CONSTRAINT PK_POSTING_RESULT_DETAIL PRIMARY KEY(PRD_SCHOOL_ID, PRD_PSLE_INDEX, PRD_BC_FIN);
COMMIT;