[Oracle]-Create DB on Oracle 12c for application

Source: Internet
Author: User

Let ' s say we is 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:

    • Application is to Wbbank, so name is Wbbank
    • Application DB is running in a individual PDB
    • Application DB have its own tablespace
    • There is both users for this DB, one was to administrate objects of the db (Schema), which was used by DBA and other one is To operate the data, which was used by application

Following is details:

1. Create PDB and its DBA user
Sqlplus sys as sysdbacreate pluggable DATABASE pdbwbbank  ADMIN USER wbbank_dba identified by Oracle  ROLES = (dba) C2/>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)  PAT H_prefix = '/u01/app/oracle/oradata/orcl/pdbs/pdbwbbank/'  file_name_convert = ('/u01/app/oracle/oradata/orcl/ Pdbseed/', '/u01/app/oracle/oradata/orcl/pdbs/pdbwbbank/');

2. Open PDB
Alter pluggable database Pdbwbbank open;

Now you can remote access the this PDB with service name, Pdbwbbank.

3. Create tablespace

Conn Wbbank_dba/[email protected]create tablespace wbbank datafile '/u01/app/oracle/oradata/orcl/pdbs/pdbwbbank/ wbbank01.dbf ' size 100M autoextend on next 10M MAXSIZE UNLIMITED;


4. Create Admin user and app user

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 unlimite D on Wbbank;create role wbbank_user_role;grant create session to Wbbank_user_role;grant Wbbank_user_role to Wbbank_user;

5. Test
Conn wbbank_dba/[email protected]--Create table users in Schema wbbank_ownercreate table wbbank_owner.users (ID number (10 ) not NULL,  username VARCHAR2 (a) NOT null UNIQUE,  password varchar2 (.) not NULL,  create_date TIMESTAMP DEFA ULT sysdate,  CONSTRAINT users_pk PRIMARY KEY (id));--must grant access privileges to Wbbank_user or wbbank_user_role, Otherwise synonym is uselessgrant all privileges on wbbank_owner.users to wbbank_user_role;--create private synonym in Sch Ema wbbank_usercreate synonym wbbank_user.users for wbbank_owner.users;

Try
Conn Wbbank_user/[email Protected]select * from users;

Remarks
    • Wbbank_owner is to manage objects, all objects is created under Wbbank_owner. It has RESOURCE role. Please note RESOURCE role doesn ' t has synonym creation role.
    • Wbbank_user is the only to operate data through synonyms.
    • WBBANK_DBA create synonym and grant privileges to data operator, Wbbank_user. It has DBA role, it's DBA of this PDB.

[Oracle]-Create DB on Oracle 12c for application

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.