当前位置:网站首页>2.Oracle-数据文件的添加及管理
2.Oracle-数据文件的添加及管理
2022-07-05 06:20:00 【寒叶飘逸_】
- 查询V$DATAFILE、DBA_DATA_FILES表
查询V$DATAFILE
select name,file#,checkpoint_change# from v$datafile;

查询DBA_DATA_FILES
select tablespace_name,autoextensible,file_name from dba_data_files;

- 为users表空间添加数据文件users03.dbf,大小10mb
alter tablespace users add datafile 'D:\app\Snakewood\oradata\orcl\users03.dbf' size 10m;


- 为users表空间添加数据文件user02.dbf,大小10mb,自动扩展
alter tablespace users add datafile 'D:\app\Snakewood\oradata\orcl\user02.dbf' size 10m autoextend on;


3. 为users表空间添加数据文件users05.dbf,大小10mb,最大值50mb
alter tablespace users add datafile 'D:\app\Snakewood\oradata\orcl\users05.dbf' size 10m autoextend on maxsize 50m;


4. 修改users表空间中的users03.dbf为自动扩展,每次扩展5mb,最大20mb
alter database datafile 'D:\app\Snakewood\oradata\orcl\users03.dbf' autoextend on next 5m maxsize 20m;

- 把数据库改为归档方式
首先,查询数据库当前是否处于归档模式
select name,log_mode from v$database;

关闭数据库,在mount模式中修改数据库为归档模式,重新启动数据库
检查当前数据库的归档模式
6. 将users01.dbf脱机,观察控制文件的变化
脱机前:

脱机后:
alter database backup controlfile to trace as 'C:\Users\Snakewood\Desktop\offline.txt';


脱机(offline)后恢复联机(online):
7. 将users03.dbf更名为users003.dbf,users02移动到e盘(尝试3种方法)
将users03.dbf更名为users003.dbf:
① 只对users03.dbf脱机
先修改文件名为users003.dbf
进行脱机操作
修改控制文件中的记录

重新连接数据库并进行online
② 对表空间脱机
修改文件名为users03.dbf
进行脱机操作
① 只对users003.dbf脱机
修改控制文件中的记录

重新连接数据库
② 对表空间进行脱机操作
将表空间置为脱机状态
移动users003到新文件夹后命名为users203
修改控制文件信息
将表空间联机
边栏推荐
- Leetcode-6108: decrypt messages
- Is it impossible for lamda to wake up?
- [rust notes] 13 iterator (Part 2)
- [2021]GIRAFFE: Representing Scenes as Compositional Generative Neural Feature Fields
- SQLMAP使用教程(二)实战技巧一
- Leetcode-31: next spread
- redis发布订阅命令行实现
- [2021]IBRNet: Learning Multi-View Image-Based Rendering Qianqian
- Regulations for network security events of vocational group in 2022 Guizhou Vocational College skill competition
- MatrixDB v4.5.0 重磅发布,全新推出 MARS2 存储引擎!
猜你喜欢
随机推荐
Quickly use Amazon memorydb and build your own redis memory database
FFmpeg build下载(包含old version)
LeetCode 1200. Minimum absolute difference
P2575 master fight
[2021]GIRAFFE: Representing Scenes as Compositional Generative Neural Feature Fields
5.Oracle-表空间
Leetcode heap correlation
MySQL advanced part 2: SQL optimization
[wustctf2020] plain_ WP
Appium automation test foundation - Summary of appium test environment construction
Is it impossible for lamda to wake up?
Leetcode-22: bracket generation
[rust notes] 17 concurrent (Part 2)
Daily question 1189 Maximum number of "balloons"
1041 Be Unique
Chapter 6 relational database theory
MatrixDB v4.5.0 重磅发布,全新推出 MARS2 存储引擎!
LeetCode-54
TypeScript 基础讲解
Leetcode recursion






![[wustctf2020] plain_ WP](/img/66/fdf7649359f36444703ff2279562e6.jpg)

