当前位置:网站首页>How to create new user for ORACLE 19c (CDB & PDB)
How to create new user for ORACLE 19c (CDB & PDB)
2022-06-29 12:25:00 【Dreamer DBA】
ORACLE 19c A new user
Data base 、 user 、CDB And PDB The relationship between

Usually in CDB Built on User is common user, Add... Before creating a new user name C##. stay PDB The user created on is local user.
stay CDB Create users on
1.Guarante this action under the CDB enviroment.
[[email protected] ~]$ sqlplus system/system as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jun 29 10:12:29 2022
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> select name,cdb from v$database;
NAME CDB
--------- ---
ORCLCDB YES
2. Create New User
SQL> create user C##test identified by testpass;
User created.
3.setting authority
SQL> grant dba,connect,resource,create view to C##test;
Grant succeeded.
SQL> grant create session to C##test;
Grant succeeded.
SQL> grant select any table to C##test;
Grant succeeded.
SQL> grant update any table to C##test;
Grant succeeded.
SQL> grant insert any table to C##test;
Grant succeeded.
SQL> grant delete any table to C##test;
Grant succeeded.
4. Drop user
SQL> drop user C##test cascade;
User dropped.
SQL>
Create new user on PDB
- check the PDB name
SQL> select pdb_id,pdb_name,dbid,status,creation_scn from dba_pdbs;
PDB_ID
----------
PDB_NAME
--------------------------------------------------------------------------------
DBID STATUS CREATION_SCN
---------- ---------- ------------
3
ORCLPDB1
634705280 NORMAL 2156143
2
PDB$SEED
1473614105 NORMAL 2014329
PDB_ID
----------
PDB_NAME
--------------------------------------------------------------------------------
DBID STATUS CREATION_SCN
---------- ---------- ------------
SQL> select con_id,dbid,NAME,OPEN_MODE from v$pdbs;
CON_ID DBID
---------- ----------
NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
2 1473614105
PDB$SEED
READ ONLY
3 634705280
ORCLPDB1
READ WRITE
CON_ID DBID
---------- ----------
NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
Local User PDB Name is ORCLPDB1
Enter into the PDB enviroment
SQL> alter session set container=ORCLPDB1;
SQL> alter session set container=ORCLPDB1
2 ;
Session altered.New User
SQL> create user test2 identified by test2pass;
User created.
SQL> Setting authority
grant dba,connect,resource,create view to test2;
grant select any table to test2;
grant update any table to test2;
grant insert any table to test2;
grant delete any table to test2;
grant create session to test2;Setting the TNS
If not setting the TNS, it will be failed . error message is user/password error , due to the user on CDB defaultly. need to change the file tnsname.ora on remote linux oracle path network/admin(/opt/oracle/product/19c/dbhome_1/network/admin)

# tnsnames.ora Network Configuration File: /opt/oracle/product/19c/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCLCDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = MaxwellDBA)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCLCDB)
)
)
LISTENER_ORCLCDB =
(ADDRESS = (PROTOCOL = TCP)(HOST = MaxwellDBA)(PORT = 1521))
ORCLPDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = MaxwellDBA)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCLPDB1)
)
)
LISTENER_ORCLPDB1 =
(ADDRESS = (PROTOCOL = TCP)(HOST = MaxwellDBA)(PORT = 1521))
Login user:

边栏推荐
- GBase8s数据库select有ORDER BY 子句4
- Titanium dynamic technology: our Zadig landing Road
- MySQL主从同步之 异步复制 半同步复制 全同步复制
- Ttchat x Zadig open source co creates helm access scenarios, and environmental governance can be done!
- Serving millions of developers, the first techo day Tencent technology open day released 7 "lightweight" products
- torch. Load load model error: can't get attribute 'VAE_ vc‘ on <module ‘__ main__‘ From 'xxxx() run file path‘
- Students' programming stories
- Gbase 8s extended external connection 1
- 什么是外链和内链?
- ArtBench:第一个类平衡的、高质量的、干净注释的和标准化的艺术品生成数据集
猜你喜欢

速看|期待已久的2022年广州助理检测工程师真题解析终于出炉

How can colleges and universities build future oriented smart campus based on cloud native? Full stack cloud native architecture vs traditional IT architecture

The blackened honeysnow ice city wants to grasp the hearts of consumers by marketing?

如何查看网站已经保存的密码

Jericho's position on initiating the connection back to the opposite ear: 【 chapter 】

多项目开发入门-业务场景关联基础入门测试 工资表

Imile uses Zadig's multi cloud environment to deploy thousands of times a week to continuously deliver global business across clouds and regions

亲测!Centos7部署PHP + Swoole

Dragon Book tiger Book whale Book gnawing? Try the monkey book with Douban score of 9.5

每周推荐短视频:爱因斯坦是怎样思考问题的?
随机推荐
MySQL 主从复制原理以及流程
Helping the ultimate experience, best practice of volcano engine edge computing
Easy express: we use Zadig to realize 10000 times of construction and deployment, smart operation and maintenance, and release development productivity
Engineering practice behind dall-e 2: ensure that the output of the model complies with the content policy
GBase8s数据库INTO EXTERNAL 子句
联想领像 lenovoimage 部分打印机 驱动 PPD 文件
GBase8s数据库INTO STANDARD 和 INTO RAW 子句
Titanium dynamic technology: our Zadig landing Road
Kyligence Zen, an intelligent indicator driven management and decision-making platform, is newly launched and is in limited internal testing
& 3 view request message and response message in browser
力扣每日一题-第31天-1779.找到最近的有相同x或y坐标的点
【综合案例】信用卡虚拟交易识别
内插散点数据
How do I open an account now? Is there a faster and safer opening channel
Zhengda futures liu4 data integration
Jerry's about TWS pairing mode configuration [chapter]
Wang Yingqi, founder of ones, talks to fortune (Chinese version): is there any excellent software in China?
&4 express框架
Jerry's about TWS channel configuration [chapter]
一种可解释的几何深度学习模型,用于基于结构的蛋白质结合位点预测