日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

oracle数据库迁移 增大空间,Oracle数据库迁移、创建表空间、创建数据表实例讲解-Oracle...

發布時間:2023/12/31 数据库 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle数据库迁移 增大空间,Oracle数据库迁移、创建表空间、创建数据表实例讲解-Oracle... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

數據庫遷移

對于數據庫遷移來說,如果源數據庫與目標數據庫版本一致,推薦使用Oracle導入或者pl/sql導入;如果版本不一致,則可以使用sql導入的方式。

創建表空間

create tablespace test datafile 'E:\Database\data\test_data.dbf' size 20M autoextend on next 5M maxsize 500M

test為表空間名稱;datafile ‘E:\Database\data\test_data.dbf’指定表空間的物理文件;size 20M 指定物理文件的大小,autoextend指定當數據量超出物理文件的存儲空間時,自動增加文件的大小;而 on next 5M 則指定每次增長的尺寸是5M;maxsize 500M指定表空間的最大尺寸是500M

修改數據庫的默認表空間

alter database default tablespace test

默認表空間修改為test

表空間的重命名

alter tablespace test rename to test_data

表空間重命名為test_data

刪除表空間

刪除表空間時,必須保證此表空間不再被其他用戶引用

drop tablespace test_data including contents and datafiles

刪除名字是test_data的表空間

創建數據表

create table student

(

studentID Number not null,

studentName varchar2(20),

studentAge number,

status varchar2(3),

version number default 0

)

tablespace users

tablespace users表示將表創建于表空間users中

通過視圖user_tables可以獲得當前用戶所擁有的表信息,如查看student的表空間信息

select table_name ,tablespace_name from user_tables where lower(table_name)='student'

查看表結構(在命令窗口中運行,語句結束必須加;號,按回車鍵執行。)

desc student;

給數據表增加列

alter table student add(class_id number);

一次性增加多個列,其中用逗號分割

修改某列的數據類型

alter table student modify(calss_id varchar2(20))

刪除已有列

alter table student drop column class_id

重命名列

alter table student rename column studentID to id

轉移表空間

alter table student move tablespace users

刪除數據表

drop table studrnt

有時由于約束存在,無法刪除。應執行

drop table student cascade constraints

特殊的數據表dual

dual實際屬于系統用戶sys,具有數據庫基本權限的用戶都可以訪問。

dual提供了一行一列的數據格式,從而使各種表達式、函數運算在以其為數據源時更夠輸出單行單列的形式

select sysdate from dual

獲得當前日期

select 5*4.5+7 result from dual

總結

以上是生活随笔為你收集整理的oracle数据库迁移 增大空间,Oracle数据库迁移、创建表空间、创建数据表实例讲解-Oracle...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。