The syntax for creating a log file is as follows:
ALTER DATABASE database_name add Logfile[group group_number]
(file_name[,file_name[,...]]) [SIZE number] [Reuse];
The syntax is described below;
Group Group_number Specifies the number of groups for the log file
file_name Create log file members for this group
Size number Specifies the number of log file members
Reuse if you create a log file member already exists, you can use the Reuse keyword to overwrite a file that already exists. However, if the file cannot already belong to another log filegroup, it cannot be replaced.
Create a log file
To create a log file, which generally refers to adding log members to a log file, you need to use the ALTER DATABASE ... add LOGFILE member statement.
For example, add a new log file to the log Filegroup Group 4;
ALTER DATABASE add LogFile Member
' F:\orealcfile\logfile\record.log ' to group 4;
We first query the log file groups in the database:
Sql> select Group#,member from V$logfile;
group# MEMBER
-------------------------------------------------------------------------------
3 D:\ORACLE\ORADATA\ORACLE12C\REDO03. LOG
2 D:\ORACLE\ORADATA\ORACLE12C\REDO02. LOG
1D:\ORACLE\ORADATA\ORACLE12C\REDO01. LOG
Then add the log file to the log file group
sql> ALTER DATABASE add logfile Group 4
(
' F:\\oracledata\logfile\redo1.log ',
' F:\oracledata\logfile\redo2.log '
) size 10m;
The database has changed.
Again, we can see that the database log file group in the system has a number 4th database filegroup
Sql> select Group#,member from V$logfile;
group# MEMBER
-------------------------------------------------------------------------------
3 D:\ORACLE\ORADATA\ORACLE12C\REDO03. LOG
2 D:\ORACLE\ORADATA\ORACLE12C\REDO02. LOG
1 D:\ORACLE\ORADATA\ORACLE12C\REDO01. LOG
4 F:\ORACLEDATA\LOGFILE\REDO1. LOG
4 F:\ORACLEDATA\LOGFILE\REDO2. LOG
Create a log file to add the log file to the log Group 4
sql> ALTER DATABASE Add logfile member//add a member for the corresponding log
2 ' F:\oracledata\logfile\redo3.log '
3 to group 4;
The database has changed.
Sql> the database log file group for the Select Group#,member from v$logfile;//system
group# MEMBER
-------------------------------------------------------------------------------
3 D:\ORACLE\ORADATA\ORACLE12C\REDO03. LOG
2 D:\ORACLE\ORADATA\ORACLE12C\REDO02. LOG
2 D:\ORACLE\ORADATA\ORACLE12C\REDO01. LOG
4 F:\ORACLEDATA\LOGFILE\REDO1. LOG
4 F:\ORACLEDATA\LOGFILE\REDO2. LOG
3 F:\ORACLEDATA\LOGFILE\REDO3. LOG
Oracle Create log file