用Sql Developer將SQL移植到Oracle(二)
本文介紹SQL 移植的第二部分:建立資料檔案庫(Migration Repository)。
一、連接到Oracle
在程序左邊的連接窗口中,點擊加號按鈕,添加一個到Oracle數(shù)據(jù)庫的dba連接,如下圖:
配置完成后,點擊連接按鈕,連接到數(shù)據(jù)庫。
二,建立用戶
打開到Oracle數(shù)據(jù)的連接,新建一個用戶,我們要在該用戶的模式中建立所謂的“資料檔案庫”,并使用該用戶去建立SQL Server移植后的用戶名,以及做其它的一些工作。按照幫助中的說明,這個用戶最少需要以下權限和角色:
Roles:CONNECT WITH ADMIN OPTION,RESOURCE WITH ADMIN OPTION.
Privileges:ALTER ANY ROLE,ALTER ANY SEQUENCE,ALTER ANY TABLE,ALTER TABLESPACE,ALTER ANY TRIGGER,COMMENT ANY TABLE,CREATE ANY SEQUENCE,CREATE ANY TABLE,CREATE ANY TRIGGER,CREATE VIEW WITH ADMIN OPTION,CREATE PUBLIC SYNONYM WITH ADMIN OPTION,CREATE ROLE,CREATE USER,DROP ANY SEQUENCE,DROP ANY TABLE,DROP ANY TRIGGER,DROP USER,DROP ANY ROLE,GRANT ANY ROLE,INSERT ANY TABLE,SELECT ANY TABLE,UPDATE ANY TABLE.
以下語句直接建立一個名為migrations的用戶:
-- Create the user
- create user MIGRATIONS
- identified by MIGRATIONS
- default tablespace USERS
- temporary tablespace TEMP
- profile DEFAULT;
-- Grant/Revoke role privileges
- grant connect to MIGRATIONS with admin option;
- grant resource to MIGRATIONS with admin option;
-- Grant/Revoke system privileges
- grant alter any role to MIGRATIONS;
- grant alter any sequence to MIGRATIONS;
- grant alter any table to MIGRATIONS;
- grant alter any trigger to MIGRATIONS;
- grant alter tablespace to MIGRATIONS;
- grant comment any table to MIGRATIONS;
- grant create any sequence to MIGRATIONS;
- grant create any table to MIGRATIONS;
- grant create any trigger to MIGRATIONS;
- grant create any view to MIGRATIONS;
- grant create materialized view to MIGRATIONS with admin option;
- grant create public synonym to MIGRATIONS with admin option;
- grant create role to MIGRATIONS;
- grant create session to MIGRATIONS with admin option;
- grant create synonym to MIGRATIONS with admin option;
- grant create tablespace to MIGRATIONS;
- grant create user to MIGRATIONS;
- grant create view to MIGRATIONS with admin option;
- grant drop any role to MIGRATIONS;
- grant drop any sequence to MIGRATIONS;
- grant drop any table to MIGRATIONS;
- grant drop any trigger to MIGRATIONS;
- grant drop tablespace to MIGRATIONS;
- grant drop user to MIGRATIONS;
- grant grant any role to MIGRATIONS;
- grant insert any table to MIGRATIONS;
- grant select any table to MIGRATIONS;
- grant unlimited tablespace to MIGRATIONS with admin option;
- grant update any table to MIGRATIONS;
再次點擊連接中的加號按鈕,添加一個使用剛剛新建立的用戶的連接。
連接后,在該連接上點擊右鍵,選擇移植資料檔案庫-關聯(lián)移植資料檔案庫,程序會在該用戶下建立移植資料檔案庫所需要的表、存儲過程等等,彈出一個對話框顯示當前建立的進度,稍等片刻即建立完畢。
原文出處:http://www.cnblogs.com/hiizsk/archive/2011/07/10/2102454.html。
【編輯推薦】