Oracle資料庫遷移

來源:互聯網
上載者:User

標籤:結構   _id   自動   tab   count   from   許可權   索引   pre   

1 在資料移轉時,使用者首先有許可權修改資料庫,並且進行資料表空間建立、刪除等權利例如:select * from dba_tab_privs where grantee=‘SCOT‘; ---查看SCOTT許可權(sys使用者登入)顯示結果為:  select * from dba_role_privs where grantee=‘SCOT‘; --查看SCOTT角色顯示結果為: (1) 如果使用者被鎖定通過以下語句來解鎖表alter user scott account unlock; --解鎖表(2) 授予使用者權限grant connect to scott; --串連資料庫許可權grant resource to scott; --授予建立表等基本許可權grant dba to scott; --授予DBA許可權 2 建立資料表空間嚴格意義上在先執行如下命令而不是直接開始建立資料表空間drop tablespace 資料表空間名稱;然後開始建立資料表空間create tablespace xx_bp;datafile ‘F:\app\xx_bp.ora‘ --資料表空間的本地位置size 50Mautoextend on next 1M; 附:datafile 為資料表空間對應的資料檔案,後面跟隨資料檔案的路徑及資料檔案名size 為資料檔案的初始大小autoextend on 表示資料隨著資料量的增加自動擴大一般在建立表的時候會建立多個資料表空間用來存放各種資料,比如我們一般會建立曆史資料表空間(HS)、索引資料表空間等。另外先建立資料表空間,然後建立使用者時指向此資料表空間,否則oracle會預設將使用者指向sys資料表空間 3 建立使用者create user 使用者名稱 indentified by 密碼 tablespace xx_bp,xx_hs,xx_indx; 附: identified by 為建立使用者密碼的關鍵字,後面跟隨的是使用者密碼 4 對資料庫的使用者進行授權grant connect,resource to 使用者名稱將connect 和resource 角色授予使用者 查看目前使用者有哪些角色select * from user_role_privs; 5 建立資料結構、預存程序、視圖、序列(1)建立表create table XX.BP_OPER_DETAIL_TB(task_id VARCHAR2(50) not null,flow_id NUMBER(19) not null,task_no VARCHAR2(50) not null,flow_node VARCHAR2(4) not null,workitemid NUMBER(19) not null,trans_id VARCHAR2(10) not null,trans_no CHAR(6) not null,vouch_group VARCHAR2(10) not null,teller_no VARCHAR2(15) default ‘‘,user_no VARCHAR2(15) not null,organ_no VARCHAR2(10) not null,areacode VARCHAR2(5) default ‘‘,create_time CHAR(14) not null,checkout_time CHAR(14) not null,checkin_time CHAR(14) default ‘‘,suspend_time CHAR(14) default ‘‘,resume_time CHAR(14) default ‘‘,trans_time INTEGER default 0,release_time INTEGER default 0,state INTEGER not null,result VARCHAR2(10) default ‘‘,reason VARCHAR2(512) default ‘‘)tablespace XX_BP pctfree 10 initrans 1 maxtrans 255 storage(initial 64K next 8K minextents 1 maxextents unlimited); 建立索引約束調節等alter table XX.BP_OPER_DETAIL_TB add constraint BP_OPER_DETAIL_PK primary key(TASK_ID, WORKITEMID, FLOW_NODE)using index tablespace XX_BP pctfree 10 initrans 2 maxtrans 255 storage(initial 64K next 1M minextents 1 maxextents unlimited); 6 匯入資料 insert into SM_FIELD_PARENT_TB (field_id, parent_field, last_modi_date)values (‘VH0007‘, ‘VH0000‘, ‘20160420074707‘);insert into SM_FIELD_PARENT_TB (field_id, parent_field, last_modi_date)values (‘VH0008‘, ‘VH0000‘, ‘20160420074729‘);insert into SM_FIELD_PARENT_TB (field_id, parent_field, last_modi_date)values (‘VH0010‘, ‘VH0000‘, ‘20160420074818‘);insert into SM_FIELD_PARENT_TB (field_id, parent_field, last_modi_date)values (‘VH0012‘, ‘VH0000‘, ‘20160420074914‘);insert into SM_FIELD_PARENT_TB (field_id, parent_field, last_modi_date)values (‘VH0016‘, ‘VH0000‘, ‘20160420075055‘);insert into SM_FIELD_PARENT_TB (field_id, parent_field, last_modi_date)values (‘VH0017‘, ‘VH0000‘, ‘20160420075129‘);insert into SM_FIELD_PARENT_TB (field_id, parent_field, last_modi_date)values (‘VH0021‘, ‘VH0000‘, ‘20160420075305‘);commit; 最後重新登陸資料庫,驗證新增的遷移資料庫

Oracle資料庫遷移

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.