1.主库添加临时文件
SQL> create temporary tablespace temp_1 tempfile '+datadg' size 10m;
Tablespace created.
SQL> alter system archive log current;
System altered.
col file_name for a50;
set lines 150
select file_name,tablespace_name from dba_temp_files;
FILE_NAME TABLESPACE_NAME
-------------------------------------------------- ------------------------------
+DATADG/ORCL/TEMPFILE/temp.265.954623079 TEMP
+DATADG/ORCL/TEMPFILE/temp_1.605.963692313 TEMP_1
SQL>
2.查看备库
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ ONLY WITH APPLY
SQL> col file_name for a50;
SQL> set lines 150
SQL> select file_name,tablespace_name from dba_temp_files;
FILE_NAME TABLESPACE_NAME
-------------------------------------------------- ------------------------------
+DATADG/ORCLDG/TEMPFILE/temp.406.962961491 TEMP
SQL>
--查看备库日志
*********************************************************************
WARNING: The following temporary tablespaces contain no files.
This condition can occur when a backup controlfile has
been restored. It may be necessary to add files to these
tablespaces. That can be done using the SQL statement:
ALTER TABLESPACE <tablespace_name> ADD TEMPFILE
Alternatively, if these temporary tablespaces are no longer
needed, then they can be dropped.
Empty temporary tablespace: TEMP_1
*********************************************************************
解决方法
备库直接添加一个临时文件
3.备库执行
SQL> alter tablespace temp_1 add tempfile '+datadg' size 10m;
Tablespace altered.
SQL> col file_name for a50;
SQL> set lines 150
SQL> select file_name,tablespace_name from dba_temp_files;
FILE_NAME TABLESPACE_NAME
-------------------------------------------------- ------------------------------
+DATADG/ORCLDG/TEMPFILE/temp.406.962961491 TEMP
+DATADG/ORCLDG/TEMPFILE/temp_1.342.963694567 TEMP_1
重启备库,查看告警日志,无报错。
小结
1.主库添加临时表空间,备库数据字典存在表空间信息。
2.备库dba_temp_files数据字典不存在临时文件记录。
3.备库open状态直接添加一个临时文件即可。
4.ADG的文件管理方式和单机、RAC管理方式不同,需要大家多去测试。