/*第1步:建立數據表空間 */
create tablespace TBS_EA_ACCOUNT
logging
datafile 'E:\tablespace\TBS_EA_ACCOUNT.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
create tablespace TS_KAMS
logging
datafile 'E:\tablespace\TS_KAMS.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
CREATE temporary tablespace TBS_TEMP_EA_MOFS
tempfile 'E:\tablespace\TBS_TEMP_EA_MOFS.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
--DROP TABLESPACE TBS_TEMP_EA_MOFS;
create tablespace TBS_EA_CMP
logging
datafile 'E:\tablespace\TBS_EA_CMP.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local; sql
create tablespace TBS_EA_CLEAR
logging
datafile 'E:\tablespace\TBS_EA_CLEAR.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local; 數據庫
create tablespace TBS_EA_IST
logging
datafile 'E:\tablespace\TBS_EA_IST.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
/*刪除表空間 */
drop tablespace TBS_EA_IST including contents and datafiles ;windows
/*第3步:建立用戶並指定表空間 */
create user CITICSUTIL identified by CITICSUTIL
default tablespace USERS
temporary TABLESPACE TBS_TEMP_EA_MOFS ;
create user ea_ist identified by ea_ist
default tablespace TBS_EA_IST ; oracle
create user ES_DBA identified by ES_DBA
default tablespace TBS_TEMP_EA_MOFS ;
create user ES_EDC identified by ES_EDC
default tablespace TBS_TEMP_EA_MOFS ;ide
create user EA_TRUST identified by EA_TRUST
default tablespace TBS_TEMP_EA_MOFS ;
create user EA_MDM identified by EA_MDM
default tablespace TBS_TEMP_EA_MOFS ;
create user EA_HOLD identified by EA_HOLD
default tablespace TBS_TEMP_EA_MOFS ;
create user EA_MOFS identified by EA_MOFS
default tablespace TBS_TEMP_EA_MOFS ;spa
create user E_TASK identified by E_TASK
default tablespace TBS_TEMP_EA_MOFS ;.net
create user DMSYS identified by DMSYS
default tablespace TBS_TEMP_EA_MOFS ;日誌
create user EI_OPEN identified by EI_OPEN
default tablespace TBS_TEMP_EA_MOFS ;ip
create user EDM_BASE identified by EDM_BASE
default tablespace TBS_TEMP_EA_MOFS ;ci
create user PRD2 identified by PRD2
default tablespace TBS_TEMP_EA_MOFS ;
create user CITICSCCS identified by CITICSCCS
default tablespace TBS_TEMP_EA_MOFS ;
create user BF_ZX_PTC identified by BF_ZX_PTC
default tablespace TBS_TEMP_EA_MOFS ;
create user HS_FUND identified by HS_FUND
default tablespace TBS_TEMP_EA_MOFS ;
/*第4步:給用戶授予權限 */
grant connect,resource,dba ,
CREATE SESSION,
CREATE ANY SEQUENCE,
CREATE ANY TABLE,
ALTER ANY TABLE,
CREATE ANY INDEX,
DELETE ANY TABLE,
INSERT ANY TABLE,
SELECT ANY TABLE,
UNLIMITED TABLESPACE,
EXECUTE ANY procedure,
UPDATE ANY TABLE,
QUERY REWRITE,
CREATE ANY VIEW to CITICSUTIL ;
/* 導入導出命令 */
ip導出方式: EXP ea_ist/ea_ist@EOSP210 file=E:/tablespace/ea_ist.dmp full=y ROWS=n
EXP CITICSUTIL/CITICSUTIL@EOSP210 file=E:/tablespace/citicsutil.dmp full=y ROWS=n
imp CITICSUTIL/CITICSUTIL@ORCL file=E:/tablespace/citicsutil.dmp full=y ignore=y LOG=E:/tablespace/citicsutil.log
imp ea_ist/ea_ist@ORCL file=E:/tablespace/ea_ist.dmp full=y ignore=y LOG=E:/tablespace/ea_ist.log
/*-------開啓歸檔模式-------------------------------------------------------------------------*/
一、鏈接
windows系統:打開cmd窗口
Linux/Unix系統:打開終端
rman target / nocatalog;
sqlplus /nolog
conn / as sysdba;
二、開啓歸檔
sqlplus>shutdown immediate;(啓動歸檔前先要中止數據庫)
sqlplus>startup mount;(數據庫以mount方式啓動)
startup mount exclusive;
sqlplus>alter database archivelog;(啓動數據庫歸檔)
--sqlplus>alter system set log_archive_dest="D:\oracle\flash_recovery_area" ; (改變歸檔日誌路徑,windows系統使用盤符)
sqlplus>alter database open;(打開數據庫)
sqlplus>archive log list;(查看歸檔是否已經打開)
關閉歸檔
alter database noarchivelog;
/*-------oracle閃回-------*/
select log_mode,open_mode,flashback_on from v$database;
show parameter db_recovery;
show parameter db_flashback --缺省爲分鐘,即小時
shutdown immediate;
startup mount exclusive;
alter system set db_flashback_retention_target=30; --設定保留時間爲半小時
alter database flashback on; --開啓閃回數據庫功能
select * from v$flashback_database_stat; --查看閃回
alter database open;
archive log list;
--=======================================================================================================
-- 查看並行度 show parameters parallel_thread
SELECT /*+parallel(t 4)*/
COUNT(*)
FROM ccs_clear_jour
WHERE settle_entity_id LIKE '%%'
---------------------------------------------------------------------------------------------------------------
STD_CMS_
collect_date NUMBER(8)
DECODE(A.BUSI_TYPE, '買', 'BUY', '賣', 'SELL', A.BUSI_TYPE) SUB_BUSI_TYPE,
DECODE(C.BUSI_UNIT_CODE,
'0001',
'81',
'0002',
'82',
'0005',
'85') CLEAR_OBJECT_CODE,
TO_DATE(A.EXCH_TIME, 'YYYY-MM-DD HH24:MI:SS') EXCH_TIME,
ABS(A.EXCH_PRICE * A.EXCH_QTY * B.CONTRACT_MULTIPLE * NVL(B.PRICE_ORG, 1)) EXCH_AMT, DECODE(A.BUSI_TYPE, '買', 1, -1) * ABS(A.EXCH_QTY) EXCH_QTY, WHERE A.STATE <> '已撤銷' AND SUBSTR(CONT_CODE, 1, 5) = B.FUTURE_PRODUCT_CODE AND TO_CHAR(TO_DATE(SUBSTR(A.EXCH_TIME, 1, 10), 'YYYY-MM-DD'), 'YYYYMMDD') = AN_I_CLEAR_DATE; EXCEPTION WHEN OTHERS THEN ROLLBACK; AN_O_RET_CODE := -1; AV_O_RET_MSG := PKG_PUB_UTILS.F_GET_ERR_MSG(SQLCODE, SQLERRM); RAISE_APPLICATION_ERROR(-20008, CASE WHEN SQLCODE = -20008 THEN '' ELSE DBMS_UTILITY.FORMAT_ERROR_BACKTRACE END, TRUE); RAISE; --序列 create sequence S_CCS_CLEAR_TRADE_BUSI_JOUR_ID minvalue 1 maxvalue 999999999999999999999999999 start with 140279 increment by 1 cache 10000; --序列 LPAD(S_CCS_CLEAR_TRADE_BUSI_JOUR_ID.NEXTVAL, 8, '0') 8位字符,左邊補0 select * from user_sys_privs where privilege like upper('%DATABASE LINK%'); grant create public database link to citicsccs; --建立dblink create public database link E31 connect to citicsccs identified by citicsccs using '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.23.118.31)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = eosp) ) )';