标签:oracle oracle12c pdb synonym create db
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">Let's say we are going to develop a application for a bank, or any other enterprise, this application need a DB. And we decide to choose Oracle 12c. Then we make a plan:</span>
Following is details:
sqlplus sys as sysdba CREATE PLUGGABLE DATABASE PDBWBBANK ADMIN USER wbbank_dba IDENTIFIED BY oracle ROLES = (dba) DEFAULT TABLESPACE WBBANK_DEFAULT DATAFILE '/u01/app/oracle/oradata/orcl/pdbs/pdbwbbank/wbbank_default.dbf' SIZE 100M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED STORAGE (MAXSIZE 2G MAX_SHARED_TEMP_SIZE 100M) PATH_PREFIX = '/u01/app/oracle/oradata/orcl/pdbs/pdbwbbank/' FILE_NAME_CONVERT = ('/u01/app/oracle/oradata/orcl/pdbseed/','/u01/app/oracle/oradata/orcl/pdbs/pdbwbbank/');
alter pluggable database pdbwbbank open;
conn wbbank_dba/oracle@pdbwbbank create tablespace WBBANK datafile '/u01/app/oracle/oradata/orcl/pdbs/pdbwbbank/wbbank01.dbf' size 100M autoextend on next 10M MAXSIZE UNLIMITED;
create user wbbank_owner identified by oracle default tablespace WBBANK quota unlimited on WBBANK; grant connect to wbbank_owner; grant resource to wbbank_owner; create user wbbank_user identified by oracle default tablespace WBBANK quota unlimited on WBBANK; create role wbbank_user_role; grant create session to wbbank_user_role; grant wbbank_user_role to wbbank_user;
conn wbbank_dba/oracle@pdbwbbank -- Create table users in schema wbbank_owner CREATE TABLE wbbank_owner.users ( id number(10) NOT NULL, username varchar2(50) NOT NULL UNIQUE, password varchar2(50) NOT NULL, create_date TIMESTAMP DEFAULT SYSDATE, CONSTRAINT users_pk PRIMARY KEY (id) ); --Must grant access privileges to wbbank_user or wbbank_user_role, otherwise synonym is useless grant all privileges on wbbank_owner.users to wbbank_user_role; --Create private synonym in schema wbbank_user create synonym wbbank_user.users for wbbank_owner.users;
conn wbbank_user/oracle@pdbwbbank select * from users;
版权声明:本文为博主原创文章,未经博主允许不得转载。
[Oracle] - Create DB on Oracle 12c for an Application
标签:oracle oracle12c pdb synonym create db
原文地址:http://blog.csdn.net/neuandustbneo/article/details/46840885