oracle資料庫基本操作

2021-07-05 08:38:42 字數 1561 閱讀 8214

–檢視磁碟使用情況

df -h

–進入oracle

su - oracle

sqlplus /nolog

conn / as sysdba

–檢視三種資料庫檔案

select * from vlo

gfil

e;–日

志檔案s

elec

t∗fr

omv datafile; –資料檔案

select * from v$controlfile; –控制檔案

–日誌檔案

–檢視歸檔日誌

select * from v$archived_log;

–檢視歸檔日誌引數

show parameter log_archive;

--歸檔日誌模式與非歸檔日誌模式轉換步驟:

--1. shutdown immediate

--2.startup mount

--3.alter database noarchivelog --歸檔轉到非歸檔

或者 alter database archivelog --非歸檔轉到歸檔

sql> alter system archive log start; --自動存檔設為啟用

sql> alter system archive log stop; --自動存檔設為禁用

--4.alter database open;

–檢視表空間使用情況

select a.tablespace_name 表空間名,

total 表空間大小,

free 表空間剩餘大小,

(total - free) 表空間使用大小,

round((total - free) / total, 4) * 100 使用率

from (select tablespace_name,

round(sum(bytes) / (1024 * 1024 * 1024), 4) free

from dba_free_space

group by tablespace_name) a,

(select tablespace_name,

round(sum(bytes) / (1024 * 1024 * 1024), 4) total

from dba_data_files

group by tablespace_name) b

where a.tablespace_name = b.tablespace_name;

–表空間新增資料檔案

alter tablespace db_temp(表空間名)

add datafile 『/u02/data/yx_idx_temp01.dbf』

size 100m –初始值

autoextend

on next 32m

maxsize 20g; –一般情況最大為32g,盡量建的資料檔案在32g以下,也可以使用 alter bigfile tablespace….

oracle資料庫基本操作

一 增 有3種方法 1.使用insert插入單行資料 insert into 表名 列名 values 列值 insert into strdents name,age values atm 12 2.使用insert,select語句將現有表中的 資料新增到已有的新錶中 insert into 已...

oracle資料庫基本操作

1.在 oracleservice 服務啟動動後,就可以對資料庫進行管理了,oracle 的啟動和關閉是最基本的命令,在 sql plus 中,啟動 oracle 必須是 sys 使用者,命令格式是 startup open oracle 服務關閉用命令 shutdownimmediate orac...

oracle資料庫基本操作

oracle建立表空間和使用者授權 sys使用者在cmd下以dba身份登入 在cmd中打sqlplus nolog 匿名登入 然後再conn as sysdba 以dba身份登入 建立臨時表空間 create temporary tablespace bigoa temp tempfile e or...