---
title: "通过pl/sql创建Oracle新用户"
author: "run_wang"
date: "2012-01-13T17:49:53Z"
tags: []
categories: ["行业应用"]
slug: "pl-sql-oracle"
draft: false
lastmod: "2012-01-13T17:49:53Z"
id: 1345012
url: "https://run-wang.iteye.com/blog/1345012"
---

创建用户和为用户分配权限
dba账号登录pl/sql developer
1、选择Users-->New，在打开的面板中输入般性用户信息
2、在Role privileges中，增加connect,resource两个Role(一般普通用户适用)，如要dba角色则同时选择dba项。
3、在System privileges中，增加create any view和unlimited tablespace两个System privilege
 
Pl/sql代码  
-- Create the user   
create user DM  
  identified by ""  
  default tablespace USERS  
  temporary tablespace TEMP  
  profile DEFAULT  
  password expire;  
-- Grant/Revoke role privileges   
grant connect to DM;  
grant dba to DM;  
grant resource to DM;  
-- Grant/Revoke system privileges   
grant create any view to DM;  
grant unlimited tablespace to DM;