oracle相關知識點

來源:互聯網
上載者:User

標籤:count   lan   role   靜默   監聽   查看   default   16.4   添加   

  oracle資料庫,執行個體名和資料庫是一一對應的,oracle服務端可以啟動多個執行個體,對應於多個資料庫。

      資料庫可以通過sqlplus / as sysdba 進入預設SID的執行個體,

        查看當前的執行個體名:select * from v$instance;

  切換進入其他執行個體,只需要export ORACLE_SID= sidname(執行個體名),再sqlplus / as sysdba 進入即可。

     

  資料庫已經存在的情況下,才存在使用者和使用者可以訪問的資料表空間,即資料存放區的表結構檔案。

 

 

一,oracle TNS listener相關:
      查看監聽器狀態:
     lsnrctl status
    啟動:
    lsnrctl start
    關閉:
    lsnrctl  stop

   修改監聽檔案的連接埠,用於網路用戶端連結:
   vi  /u01/app/oracle/product/11.2.0/network/admin/listener.ora
  修改內容(HOST = 10.116.4.63)(PORT = 1521)

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.116.4.63)(PORT = 1521))
#      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle


修改listener的SID對應檔:
vi /u01/app/oracle/product/11.2.0/network/admin/tnsnames.ora

添加SID是jjccbdb的執行個體名:
jjccbdb =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.116.4.63)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = jjccbdb)
    )
  )
 
 


二,oracle  建立/刪除執行個體庫的步驟
1、使用dbca工具靜默建庫



dbca -silent -createdatabase -templatename testdb -sid $dbname -gdbname $dbname -datafileDestination $dest -syspassword oracle -systempassword oracle \
-characterset $langu -redoLogFileSize 512 -storageType FS -emConfiguration NONE -memoryPercentage 30  -totalMemory $mem -automaticMemoryManagement true



    

2、使用dbca工具刪庫
    現有執行個體名:SRPSDB
    dbca -silent -deleteDatabase -sourcedb SRPSDB -sid SRPSDB -sysDBAUserName sys -sysDBAPassword oracle

3、建立執行個體之後,設定資料表空間和使用者存取權限

Create temporary tablespace srpsdb_tmp tempfile ‘/u01/app/oracle/oradata/SRPSDB/srpsdb_tmp.dbf‘ size 10240m autoextend on next 1024m maxsize 10240m extent management local;
create tablespace srpsdb logging datafile ‘/u01/app/oracle/oradata/SRPSDB/srpsdb.dbf‘ size 10240m autoextend on next 1024m maxsize 10240m extent management local;




Create temporary tablespace srpsdb_tmp tempfile ‘/u01/app/oracle/oradata/jjccbdb/srpsdb_tmp.dbf‘ size 10240m autoextend on next 1024m maxsize 10240m extent management local;
create tablespace srpsdb logging datafile ‘/u01/app/oracle/oradata/jjccbdb/srpsdb.dbf‘ size 10240m autoextend on next 1024m maxsize 10240m extent management local;

4、賦權使用者的訪問資料表空間
create user C identified by  123456 default tablespace srpsdb temporary tablespace srpsdb_tmp;
create user P identified by 123456 default tablespace srpsdb temporary tablespace srpsdb_tmp;
create user M identified by 123456 default tablespace srpsdb temporary tablespace srpsdb_tmp;

5、給使用者賦予角色
    grant DBA to C;
    grant DBA to P;
    grant DBA to M;

--------------

三,常用的oracle 查看使用者表及許可權相關


oracle中使用者權限分為系統許可權和使用者表許可權:
查看目前使用者表級許可權許可權:
select  * from user_tab_privs;
查看目前使用者擁有的系統許可權:
select * from user_sys_privs;

查看目前使用者下的表:
select * from user_tables;


查看某使用者的許可權:
select * from dba_sys_privs where grantee=‘M‘;

查看使用者的角色,限定當前查詢使用者是dba的前提下:
select * from dba_role_privs where grantee=‘P‘;


查看目前使用者的資料表空間:
select username,default_tablespace from user_users;



進dba角色查看:
1、sqlplus / as sysdba
2、 select    owner,table_name from dba_tables where table_name=‘ABM_ACCOUNT‘;


四,oracle的jdbc連結地址:jdbc:oracle:thin:@10.116.4.125:1521:SRPSDB(執行個體名)

oracle相關知識點

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.