当前位置:网站首页>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
修改控制文件信息
将表空间联机
边栏推荐
- Shutter web hardware keyboard monitoring
- [rust notes] 16 input and output (Part 1)
- Open source storage is so popular, why do we insist on self-development?
- redis发布订阅命令行实现
- MySQL advanced part 1: index
- Filter the numbers and pick out even numbers from several numbers
- Is it impossible for lamda to wake up?
- Niu Mei's math problems
- [BMZCTF-pwn] ectf-2014 seddit
- Bash exercise 17 writing scripts to install the server side of FRP reverse proxy software
猜你喜欢
随机推荐
Operator priority, one catch, no doubt
MySQL advanced part 1: stored procedures and functions
求组合数 AcWing 887. 求组合数 III
Leetcode-6108: decrypt messages
our solution
做 SQL 性能优化真是让人干瞪眼
Data visualization chart summary (I)
实时时钟 (RTC)
Leetcode divide and conquer / dichotomy
高斯消元 AcWing 884. 高斯消元解异或线性方程组
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
2022/6/29-日报
Leetcode-1200: minimum absolute difference
Gaussian elimination acwing 884 Gauss elimination for solving XOR linear equations
The difference between CPU core and logical processor
容斥原理 AcWing 890. 能被整除的数
WordPress switches the page, and the domain name changes back to the IP address
11-gorm-v2-03-basic query
Leetcode-6109: number of people who know secrets
Is it impossible for lamda to wake up?









