1. 程式人生 > >Oracle建立使用者、賦予許可權的過程

Oracle建立使用者、賦予許可權的過程

cmd 進入oracle命令    sqlplus /nolog   conn jrw/[email protected] create使用者   sql 程式碼SQL> create user visiontv identified by visiontv default tablespace visiontv quo   ta 10m on users;     //建立空間  create tablespace test  datafile 'c:oracleoradataorcl9test.dbf' size 50M  default storage (initial 500K   Next 500K  minextents 1  maxextents unlimited  pctincrease 0);   //Oracle建立使用者許可權//建立使用者  create user lxg identified by lxg default tablespace test;       //授權   grant resource,connect,dba to test;     //刪除表空間   drop tablespace "空間名" including contents and datafiles   刪除使用者 drop user "lxg" cascade   增加表空間 alter tablespace chinawater add datafile 'c:oracleoradataorcl9ADDCHINAWATER.dbf' size 200M   建立使用者 create user userName identified by password;   建立使用者 userName,密碼為 password   grant dba to lxg;--授予DBA許可權       grant unlimited tablespace to lxg;--授予不限制的表空間       grant select any table to lxg;--授予查詢任何表       grant select any dictionary to lxg;--授予 查詢 任何字典     grant dba to lxg;       grant unlimited tablespace to lxg;       grant select any table to lxg;       grant select any dictionary to lxg;     oracle 正在連線的使用者不能刪除,確實要刪除的話   1、select sid,serial#,username from v$session where user='USERNAME';   2、alter system kill session 'sid,serial#';   3、drop user username cascade;     3.檢視使用者所擁有的表  select table_name from user_tables; 或  select *from tab;   4.檢視使用者所擁有的檢視 select view_name from user_views;   5.檢視使用者所擁有的觸發器  select trigger_name from user_triggers;   6.檢視使用者擁有的序列  select sequence_name from user_sequence;   7.檢視使用者擁有的索引  select index_name from user_indexs;   8.顯示當前使用者 show user;   9.切換使用者  conn scott/tiger;   10.將使用者賦予某種角色登入  conn scott/tiger as sysdba;   11.檢視所有使用者  conn system/unis;  select username from dba_users;   12.檢視使用者所擁有的許可權 select *from session_privs;   13.給使用者加鎖  alter user scott account lock;   14.給使用者解鎖  alter user scott account unlock;   15.修改使用者密碼  alter user zzg identified by zzg123   16.新建使用者   create user zzg identified by zzg123;   17.刪除使用者及相關物件  drop user zzg cascade;   18.給使用者賦權(多個採用逗號間隔)  grant create session,create table to zzg;   19.分配表空間給使用者  alter user zzg default tablespace ts_zzg;
================ORACLE建立例項====================
 create user local_twsms identified by local_twsms;
 grant dba to local_twsms;--授予DBA許可權  
  grant unlimited tablespace to local_twsms;--授予不限制的表空間  
  grant select any table to local_twsms;--授予查詢任何表  
  grant select any dictionary to local_twsms;--授予 查詢 任何字典
  grant dba to local_twsms;  
  grant unlimited tablespace to local_twsms;  
  grant select any table to local_twsms;  
  grant select any dictionary to local_twsms;
  grant create session,create table to local_twsms;
==================================================
建立表空間
表空間的管理分檔案系統自動儲存管理(ASM)

1.檔案系統

先檢視一下資料檔案的目錄:
select tablespace_name,file_id,file_name,autoextensible,
round(bytes/1024/1024/1024,3) "used(G)",round(maxbytes/1024/1024/1024,3) "size(G)"
from dba_data_files order by tablespace_name;

在作業系統上檢視可用儲存的大小:df -h
建立表空間
create tablespace tbs_name datafile '/dba/oradata/ORADEV/datafile/tbs_name01.dbf
' size 100m autoextend on next 100m;

表空間不足,新增資料檔案(需檢測可用儲存,以防撐爆空間)
alter tablespace tbs_name add datafile '/dba/oradata/ORADEV/datafile/tbs_name01.dbf' size 100m autoextend on next 100m;

注:預設虛擬機器環境不使用這種管理方式,下面操作過程只做知識擴充套件使用
2.自動儲存管理,資料檔案的路徑是以+DATA_DG開頭的
檢視儲存的可用空間(即free_GB的大小):
select name,total_mb/1024 total_GB,free_mb/1024 free_GB,to_char(round((total_mb-free_mb)/total_mb*100,2),'99.99')||'%' usage from v$asm_diskgroup;
建立表空間:
create tablespace tbs_name datafile '+data_dg' size 100m autoextend on next 100m;
表空間不足,新增資料檔案(需檢測可用儲存,以防撐爆空間)
alter tablespace tbs_name add datafile '+data_dg' size 100m autoextend on next 100m;
建立使用者 1.建立使用者
create user user_name identified by "user_password"
default tablespace tbs_name

temporary tablespace temp profile DEFAULT;

2.授權
grant connect to user_name;
grant create indextype to user_name
;
grant create job to user_name
;
grant create materialized view to user_name
;
grant create procedure to user_name;

grant create public synonym to user_name;
grant create sequence to user_name
;
grant create session to user_name
;
grant create table to user_name
;
grant create trigger to user_name
;
grant create type to user_name;
grant create view to user_name
;
grant unlimited tablespace to user_name
;
alter user user_name quota unlimited on tbs_name;

相關推薦

Oracle建立使用者賦予許可權過程

cmd 進入oracle命令    sqlplus /nolog   conn jrw/[email protected] create使用者   sql 程式碼SQL> create user visiontv identified by visiontv default tablespa

oracle建立使用者賦予許可權,刪除許可權

--刪除使用者及及使用者下的所有資料 drop user xxx cascade; --建立使用者賦予密碼 create user xxx identified by 1234; --賦予許可權 grant dba to xxx; --刪除許可權 revoke dba from xxx

Oracle 使用者物件許可權系統許可權

--================================ --Oracle 使用者、物件許可權、系統許可權 --================================ 一、使用者與模式     使用者:對資料庫的訪問,需要以適當使用者身份通過驗證,並具有相關許可權來完成一

oracle sql語句建立表空間使用者並給使用者賦予許可權

--建立表空間、大小100m,自增長50m ,最大為 2G;位置: 'h:\app\a.dbf' create tablespace 表空間名 datafile 'h:\app\a.dbf' size 100m autoextend on next 50m maxsize 20480m ext

Oracle給使用者賦予dba許可權並且賦予建立檢視查詢表的許可權

1、賦予dba的許可權 grant dba to user; 2、在建立使用者的時候如果直接給使用者DBA許可權,那麼在B使用者中可以直接查詢A使用者的表,但是在建立檢視時就會報無許可權, 在這種情況下需要再在被訪問的A使用者裡面去給予要訪問該表的B使用者授權。 解決

Oracle03——遊標異常存儲過程存儲函數觸發器和Java代碼訪問Oracle對象

height 微軟 數值 getc statement 數據類型 put print .exe 作者: kent鵬 轉載請註明出處: http://www.cnblogs.com/xieyupeng/p/7476717.html 1.遊標(光標)Cursor 在寫

Oracle loop循環while循環for循環if選擇和case選擇更改讀取數據遊標觸發器存儲過程

bsp 邏輯或 pda 傳遞依賴 函數 名稱 執行 count 記錄 數據庫的設計(DataBase Design): 針對於用戶特定的需求,然後我們創建出來一個最使用而且性能高的數據庫! 數據庫設計的步驟: 01.需求分析 02.概念

oracle索引視圖存儲過程觸發器oracle數據類型

real 輸出數據 image gin demo 同名 全表掃描 cas 業務規則 1、索引:索引是幫助用戶在表中快速地找到記錄的數據庫結構。 a) 自動創建索引:當你為一張表定義主關鍵或唯一性約束條件時一個惟一的索引就已經被創建了。 b) 手動創建索引: 用戶可以自己創建

cenots7檢視使用者新建使用者賦予使用者root許可權

一、檢視當前登陸使用者 whoami 二、檢視所有使用者 cut -d : -f 1 /etc/passwd 三、新建使用者 adduser xxx passwd xxx 四、賦予使用者root許可權 vi /etc/sudoers ## Allow

實驗目的: 1理解使用者與模式的概念,掌握oracle中使用者管理的基本方法 2理解系統許可權、物件許可權的概念,掌握分配許可權的方法 3理解角色的概念,掌握角色的應用方法 實驗內容: 一使用者

撰寫人——軟體二班——陳喜平 一、使用者管理與應用 1、檢視使用者與模式 show USER; 2、建立使用者 sqlplus sys/[email protected] as sysdba CREATE USER t16436220 IDENTIFIED B

Oracle 系統許可權物件許可權角色許可權

1.系統許可權:系統規定使用者使用資料庫的許可權(對使用者而言) 給使用者授予系統許可權:grant 系統許可權 to 使用者 例:grant connec,resource to scott; 2.物件許可權:某種許可權使用者對其它使用者的表或檢視的存取許可權(針對表或

ORACLE儲存遊標過程詳解

ORACLE儲存過程詳解 1、定義 所謂儲存過程(Stored Procedure),就是一組用於完成特定資料庫功能的SQL語句集,該SQL語句集經過編譯後儲存在資料庫系統中。在使用時候,使用者通過指定已經定義的儲存過程名字並給出相應的儲存過程引數來呼叫並執行它,從而完成

Oracle】PL/SQL 儲存過程 顯式遊標隱式遊標動態遊標

  【Oracle】PL/SQL 顯式遊標、隱式遊標、動態遊標 2013年06月17日 09:02:51 AlphaWang 閱讀數:13009更多 個人分類: 【Database】 在PL/SQL塊中執行SELECT、INSERT、DELET

SpringBoot+MyBatis+Oracle批處理及儲存過程Demo

    本文著重偏重於:SpringBoot+MyBatis+Oracle的,增刪改查、批處理及儲存過程的Demo,原始碼見文末章節。Demo概述    使用SpringBoot和MyBatis,對Oracle資料的增、刪、改、查、批處理、及呼叫儲存過程,都做了示例程式碼及S

ORACLE 新建資料庫及許可權賦予

新裝的oracle資料庫,預設的表空間是ORCL,現在想建立一個新的庫,在新庫下面建表。 按照如下步驟: 以system超級管理員使用者進入 1、首先,建立(新)使用者: create user username identified by password; username:新使

Linux 建立使用者賦予使用者許可權修改資料夾許可權修改只讀檔案

建立使用者 # useradd work 設定使用者密碼 # passwd work 賦予使用者許可權 方法一: 修改 /etc/sudoers 檔案,找到下面一行,把前面的

Oracle閃回恢復誤刪除的表存儲過程函數...

數據庫 函數 use 分鐘 ack ... 根據 ora interval 在日常的數據庫開發過程匯總難免會出現一些誤刪除的動作, 對於一些誤刪的操作我們可以通過oracle提供的閃回機制恢復誤刪數據, 從而避免出現較大的生產事故. 下面是本人平時工作中積累的一些常用

Oracle使用者許可權角色管理

Oracle 許可權設定一、許可權分類:系統許可權:系統規定使用者使用資料庫的許可權。(系統許可權是對使用者而言)。 實體許可權:某種許可權使用者對其它使用者的表或檢視的存取許可權。(是針對表或檢視而言的)。 二、系統許可權管理:1、系統許可權分類:DBA: 擁有全部特權,是系統最高許可權,只有DBA才可以

Oracle 建立使用者和表空間,以及賦予許可權

1.建立表空間CREATE TABLESPACE a8v6space2 DATAFILE 'c:\oadata\oa_data.dbf' SIZE 500M AUTOEXTEND ON NEXT 100M EXTENT MANAGEMENT LOCAL UNIFORM SIZ

Oracle 建立資料庫併為新建資料庫建立使用者及賦予許可權

第一步:(建立資料庫)在DatabaseConfiguration裡面建立資料庫,併為sys(超級管理員)設定密碼。第二步:(管理員身份登入):使用sys管理員以連線為SYSDBA的形式登入新建的資料庫。第三步:(為當前資料庫建立使用者):執行SQL語句 create use