当前位置:网站首页>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
修改控制文件信息
将表空间联机
边栏推荐
猜你喜欢

Sorting out the latest Android interview points in 2022 to help you easily win the offer - attached is the summary of Android intermediate and advanced interview questions in 2022

Open source storage is so popular, why do we insist on self-development?

liunx启动redis

MySQL怎么运行的系列(八)14张图说明白MySQL事务原子性和undo日志原理

传统数据库逐渐“难适应”,云原生数据库脱颖而出

Doing SQL performance optimization is really eye-catching

LeetCode 0108. Convert an ordered array into a binary search tree - the median of the array is the root, and the left and right of the median are the left and right subtrees respectively

RGB LED infinite mirror controlled by Arduino

LeetCode-54

MySQL advanced part 1: View
随机推荐
Traversal of leetcode tree
our solution
2022/6/29-日报
4. 对象映射 - Mapping.Mapster
做 SQL 性能优化真是让人干瞪眼
求组合数 AcWing 887. 求组合数 III
区间问题 AcWing 906. 区间分组
【LeetCode】Day94-重塑矩阵
Daily question 1189 Maximum number of "balloons"
LeetCode-54
博弈论 AcWing 891. Nim游戏
MySQL advanced part 1: triggers
求组合数 AcWing 888. 求组合数 IV
高斯消元 AcWing 884. 高斯消元解异或線性方程組
Leetcode-556: the next larger element III
Suppose a bank's ATM machine, which allows users to deposit and withdraw money. Now there is 200 yuan in an account, and both user a and user B have the right to deposit and withdraw money from this a
Niu Mei's math problems
求组合数 AcWing 889. 满足条件的01序列
The difference between CPU core and logical processor
1040 Longest Symmetric String