自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Oracle數(shù)據(jù)庫的一些常用維護(hù)操作總結(jié)

數(shù)據(jù)庫 Oracle
本文主要介紹了Oracle數(shù)據(jù)庫的一些常用的維護(hù)操作,包括系統(tǒng)方面的維護(hù)和命名空間的維護(hù)等,希望能夠?qū)δ兴鶐椭?/div>

我們知道,對數(shù)據(jù)庫的維護(hù)是數(shù)據(jù)庫保證數(shù)據(jù)庫安全穩(wěn)定運(yùn)行中必不可少的一個環(huán)節(jié)。本文我們總結(jié)了一些Oracle數(shù)據(jù)庫的一些常用的維護(hù)操作,包括一些常規(guī)的維護(hù)操作,一些系統(tǒng)的維護(hù)操作以及命名空間的維護(hù)操作等,接下來就讓我們來一起了解一下吧!

常規(guī):

Oracle在sqlplus命令行下,執(zhí)行完數(shù)據(jù)庫操作以后,需要跟上commit才能生效。

主要監(jiān)聽兩個端口,1521是數(shù)據(jù)庫連接端口,8080是服務(wù)器端口。

Oracle默認(rèn)安裝完畢,會自帶一個http服務(wù)器,以web的形式提供用戶管理界面,該服務(wù)器端口8080與tomcat的默認(rèn)端口一樣,是導(dǎo)致tomcat啟動不了的常見原因,我一般是修改tomcat的配置文件server.xml,把http1.1的端口改成8081。

系統(tǒng)維護(hù):

登錄

sqlplus username/password@addr [as sysdba,sysoper]

不寫地址默認(rèn)是localhost 不寫身份默認(rèn)是sysoper

查詢sid

select instance_name from v$instance

查詢數(shù)據(jù)庫版本

Select version FROM Product_component_version Where SUBSTR(PRODUCT,1,6)='Oracle';

查詢監(jiān)聽:lsnrctl status--在cmd下而不是sqlplus下

啟動監(jiān)聽:lsnrctl start--在cmd下而不是sqlplus下

停止監(jiān)聽:lsnrctl stop--在cmd下而不是sqlplus下

創(chuàng)建用戶

 

  1. create user weinianjie identified by "123" default tablespace sheep temporary tablespacetemp profile default;  
  2.  
  3. grant resource,connect,dba to weinianjie; 

 

查詢當(dāng)前用戶

show user;

命名空間:

解釋:

百度百科原話:“ORACLE數(shù)據(jù)庫被劃分成稱作為表空間的邏輯區(qū)域——形成ORACLE數(shù)據(jù)庫的邏輯結(jié)構(gòu)。一個ORACLE數(shù)據(jù)庫能夠有一個或多個Oracle,而一個表空間則對應(yīng)著一個或多個物理的數(shù)據(jù)庫文件。表空間是ORACLE數(shù)據(jù)庫恢復(fù)的最小單位,容納著許多數(shù)據(jù)庫實(shí)體,如表、視圖、索引、聚簇、回退段和臨時(shí)段等。 

每個ORACLE數(shù)據(jù)庫均有SYSTEM表空間,這是數(shù)據(jù)庫創(chuàng)建時(shí)自動創(chuàng)建的。SYSTEM表空間必須總要保持聯(lián)機(jī),因?yàn)槠浒鴶?shù)據(jù)庫運(yùn)行所要求的基本信息(關(guān)于整個數(shù)據(jù)庫的數(shù)據(jù)字典、聯(lián)機(jī)求助機(jī)制、所有回退段、臨時(shí)段和自舉段、所有的用戶數(shù)據(jù)庫實(shí)體、其它ORACLE軟件產(chǎn)品要求的表)。”

我的理解,表空間跟庫的概念差不多,一個表空間對應(yīng)一個或者多個物理文件,每個用戶屬于一個或多個表空間,其中有一個是默認(rèn)的。連接數(shù)據(jù)庫的時(shí)候不需要制定表空間,用戶創(chuàng)建的對象會在用戶默認(rèn)的表空間里存放著。

命名空間定義了一組對象類型,在命名空間里,對象的名字必須是唯一的,當(dāng)然,在不同的命名空間里,是可以使用相同的的名字的。

下面的對象類型共享同一個命名空間:

 

  1. ? Tables  
  2.  
  3. ? Views  
  4.  
  5. ? Sequences  
  6.  
  7. ? Private synonyms  
  8.  
  9. ? Stand-alone procedures  
  10.  
  11. ? Stand-alone stored functions  
  12.  
  13. ? Packages  
  14.  
  15. ? Materialized views  
  16.  
  17. ? User-defined types 

 

創(chuàng)建數(shù)據(jù)表空間:create tablespace sheep datafile 'c:/sheep.dbf' size 20m autoextend on;

創(chuàng)建臨時(shí)表空間:create temporary tablespace sheep tempfile 'c:/sheep.dbf' size 20m autoextend on;

查詢空間:

 

  1. select tablespace_name from dba_tablespaces;  
  2.  
  3. select tablespace_name from user_tablespaces; 

 

查詢表空間的物理情況:

 

  1. select * from dba_data_files where tablespace_name='SYSTEM';--這里一定要是全大寫的,哪怕你建空間的時(shí)候沒有使用大寫  
  2.  
  3. select * from dba_temp_files where tablespace_name='TEMP';--這里一定要是全大寫的,哪怕你建空間的時(shí)候沒有使用大寫 

 

查詢表空間內(nèi)的表:

select table_name from dba_all_tables where tablespace_name='USERS';

表:

查詢當(dāng)前用戶空間的所有表:

select tname from tab

序列:

查詢當(dāng)前用戶空間的所有序列:

select squence_name from seq

創(chuàng)建序列:

create sequence user_seq minvalue 1 maxvalue 99999 start with 1 increment by 1 nocache nocycle

使用序列:

insert into user values(user_seq.nextval);

腳本:

 

  1. begin--必須以begin開頭。  
  2.  
  3. for column_ in (select * from tb1) loop  
  4.  
  5. insert into tb2 values(column_.field1);  
  6.  
  7. end loop;  
  8.  
  9. end; 

 

java交互:

驅(qū)動名稱:oracle.jdbc.driver.OracleDriver

連接字符串:jdbc:oracle:thin:@localhost:1521:xe,其中***一個量是sid 。

關(guān)于Oracle數(shù)據(jù)庫的常用維護(hù)就介紹到這里,如果您想了解更多的關(guān)于Oracle數(shù)據(jù)庫的知識,可以看一下這里的文章:http://database.51cto.com/oracle/,相信一定可以帶給您收獲的。

【編輯推薦】

  1. Oracle數(shù)據(jù)庫如何增加scott用戶與相關(guān)的表
  2. 關(guān)于SQL Server數(shù)據(jù)庫主鍵與索引的幾點(diǎn)區(qū)別
  3. Oracle數(shù)據(jù)庫排序ORDER BY子句的使用總結(jié)篇
  4. SQL Server數(shù)據(jù)同步Merge的一個BUG及解決方法
  5. 關(guān)于數(shù)據(jù)庫的三級模式:外模式、模式和內(nèi)模式的理解
責(zé)任編輯:趙鵬 來源: CSDN博客
相關(guān)推薦

2011-08-25 14:50:42

SQL Server數(shù)常用操作

2011-07-29 15:58:53

SGAOracle

2017-04-19 11:15:01

Oracle數(shù)據(jù)庫備份恢復(fù)

2011-07-22 09:58:18

Oracle數(shù)據(jù)庫優(yōu)化策略

2011-03-10 13:19:47

Oracle數(shù)據(jù)庫

2011-06-14 15:11:59

ORACLE

2011-08-18 16:42:04

Oracle數(shù)據(jù)庫維護(hù)SQL代碼示例

2011-07-22 09:09:52

Oracle數(shù)據(jù)庫SQL效率

2011-09-02 10:06:51

OracleSqlLoad常用技巧

2009-06-30 14:23:02

ORACLE數(shù)據(jù)庫JSP

2010-08-12 09:41:06

DB2數(shù)據(jù)庫恢復(fù)

2020-08-07 08:04:03

數(shù)據(jù)庫MySQL技術(shù)

2020-10-19 19:25:32

Python爬蟲代碼

2011-05-26 14:31:57

Oracle數(shù)據(jù)庫

2011-05-25 09:20:24

Oracle數(shù)據(jù)庫

2010-04-19 14:37:14

Oracle監(jiān)控

2024-01-30 10:11:00

SpringBoot項(xiàng)目開發(fā)

2010-11-29 11:51:59

Sybase數(shù)據(jù)庫維護(hù)

2010-05-04 15:59:05

Oracle字符集

2010-08-20 13:45:43

DB2數(shù)據(jù)庫
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號