First step the path required to create a tablespace file_name: Log on as Administrator system/admin, query data file name, size, and path information
Select Tablespace_name,file_id,bytes,file_name from Dba_data_files;
Second step create tablespace: Log in as Administrator system/admin, create tablespace
CREATE tablespace mytbspace
LOGGING
datafile ' d:/installsoftware/myoracle/app/administrator/oradata/ Lworcl/mytbspace.dbf '
SIZE m
autoextend on
NEXT m MAXSIZE 2048 m
EXTENT MANAGEMENT Local;
Step three Create user leiwei: Log on as Administrator system/admin, create users, and grant users Reiwei create Dblink (required permissions see step Fourth) and view permissions
--Create
the user create user Leiwei
identified by "Leiwei"
default tablespace mytablespace
Temporary Tablespace TEMP profile
DEFAULT
password expire;
--Grant/revoke role Privileges
Grant connect to Leiwei;
Grant resource to Leiwei;
--Grant/revoke System privileges
Grant create any view to Leiwei
; Grant CREATE database link to Leiwei;
Grant create public database link to Leiwei;
Grant drop public database link to Leiwei;
Grant unlimited tablespace to Leiwei;
Step fourth to see what permissions are required for Dblink: Log on as an administrator system/admin to see what permissions are required to create Dblink and assign those permissions to the corresponding users such as: Leiwei
SELECT * from User_sys_privs t
where t.privilege like Upper ('%link% ');
Step Fifth Create Dblink: Log in as a regular user Leiwei/leiwei, create Dblink
--Create DATABASE link
Create DATABASE link Dblink2area
connect to Ypdoor identified by Ypdoor
using ' (DESCRI Ption= (address_list= (
address= (protocol=tcp) (host=172.23.1.30) (port=1521))
(Connect_data=
( SERVICE_NAME=ORCL)))
';
Step Sixth Create a view: Log on as a normal user Leiwei/leiwei, create view get data from any table (EMP) in the Dblink object (172.23.1.30) database (ORCL)
Create or replace view Dblinkview as
select *
Seventh query view: Log in as normal user Leiwei/leiwei, query view dblinkview Verify data Link success
Viii. Establishment of synonyms
--Create the synonym
Create or replace synonym tele_note_groups for
puser. Tele_note_groups@dblink_portal. Regress. Rdbms. DEV. US. oracle.com;
IX. Export the data under the corresponding user in the library
Exp YPDOOR/YPDOOR@172.18.27.146/LWORCL file=d:/20111231ypdoor.dmp full=y