Oracle File System

Source: Internet
Author: User

The Oracle file system structure is as follows: the Oracle file system is mainly divided into the following four parts: 1> control file (. CTL) 2> data file (. DBF) 3> log file (. LOG) 4> the first three file systems of other files www.2cto.com are the main components of the Oracle file system, which can be found in the following path: $ ORACLE_HOME $ \ oradata \ orcl. the CTL file is the control file. the DBF file is a data file. the LOG file is a LOG file. In addition to the first three files, there is also a parameter file. The parameter file is not an effective part of the database system. When the database is started, the parameter file is not directly involved in the work, only the control file is searched for by the parameter file. Parameter file location: $ ORACLE_HOME $ \ admin \ orcl \ pfile 1.1 the data file truly stores data in the database, including tables, indexes, and attempts. Generally, the data file suffix names are all. DBF, but this is just a conventional practice. In fact, the database does not require data files. DBF is a suffix, which is easy to differentiate. We recommend that you add it when creating data files. View the file number, status, and file name of all data files SQL> select * from v $ datafile; 1.2 log files www.2cto.com are classified into three categories: alert log files -- Alarm log trace log files -- trace log (user and process) redo log file -- redo log (Record Database changes ). 1.2.1 simple principle of redo log for log files: Before the data update operation commit, write the changed SQL script to the redo log. It is mainly used for Incremental backup and incremental recovery of databases. Redo logs correspond directly to redo log files on the hard disk (online and archived). redo log files are organized in groups, A Redo log group contains one or more log files. Redo logs are divided into online Redo logs -- online Redo log files archive Redo logs -- archive Redo log files 1.2.1 online Redo log files) online redo logs indicate that Oracle records database data updates in real time in the form of SQL scripts. In other words, it saves executed SQL scripts to online log files in a specific format ). Principle of online redo log at www.2cto.com: for online redo logs, Oracle 11g creates three online log groups for each database instance by default. Each group has one log file named REDO01.LOG, REDO02.LOG and REDO03.LOG. (You can add/modify/delete log groups and log files to customize online redo logs through view operations) log files in each group have the same content and are stored in different locations, it is used for disk log images to improve security after multiple backups. By default, only one of the three groups is active, and the operation scripts are constantly written to the group. When the log file is full (the specified space quota is reached ), if the current database is in archive mode, online logs are archived to the hard disk to archive logs. If the current database is in non-archive mode, no archive operation is performed, the content of the current online log will be overwritten by the next re-write and cannot be saved. Therefore, the database is usually in archive mode at runtime to save the data update logs.

When the archive log group is full, Oracle switches to the next log group to continue writing. In this way, it switches cyclically. When it is in archive mode, it switches to the originally filled log group, if the log group is archived, the write is overwritten. If the log group is not archived, only the log buffer is used. The write can be overwritten only after the archiving is completed. Of course, writing is directly overwritten in non-archive mode. (I will talk about setting the database archive mode in another blog ). Oracle provides two views for maintaining online redo logs: V $ LOG and V $ LOGFILE. You can view and modify online logs in these two views. Of course, you can also ADD/modify/delete online logs or log groups by using alter database add or delete commands. 1.2.2 Archive Redo log files-Archive Redo logs are abbreviated as Archive logs. when conditions are met, Oracle saves online Redo logs to the hard disk (persistent) as files ). In fact, the so-called archive refers to archiving online logs and making them persistent to a fixed file to the hard disk to facilitate future recovery and query. Of course, the premise is that the database must be in the archive mode. By default, Oracle 11g sets two archiving locations for archiving logs. The Archive logs in these two archiving locations have the same content but different file names. 1.2.3 common log File Operations www.2cto.com which log file is used by the query system: select * from v $ log; query the log files corresponding to the group in use: select * from v $ logfile; force log switch: alter system switch logfile; query historical logs: select * from v $ log_history; query log archiving mode: select dbid, name, created, log_mode from v $ database; query archived log information: select recid, stamp, thread #, sequence #, name from v $ archived_log; add and delete a log file group alter database add logfile group 1 ('C: \ log1a. log'), size 100 M; alter Database drop logfile group 1; add and delete log members www.2cto.com alter database add logfile member 'log1a. log' to group 1; alter database drop logfile member 'C: \ log1a. log'; the log file moves alter database rename file 'C: \ log1a. log' to 'C: \ log1b. log'; Note: Before executing this command, ensure that the log file has been physically moved to the new directory to clear the log file alter database clear logfile C: \ log1a. log'; Note: When you use the delete group or group member command to delete logs, the 1.3 control file is a binary file that defines the physical status of the current database, each oracle database must have at least one control file. The control file is managed and maintained by the DBA. www.2cto.com 1.3.1 is characterized by 1) the control file needs to be restored if it is lost. 2) the control file can be read in the MOUNT status. 3) the control file is constantly updated during database operation. 4) each control file is associated with only one DATABASE. 5) It should be diversified. 6) Maintain DATABASE entities. 7) the initial size of the create database statement. 1.3.2 The control file contains the main content. 1) database Name and unique database ID 2) data file and Log File ID 3) synchronize information required for database recovery, that is, check point number 4) database creation time 5) tablespace name 6) currently, redo log files SCN 7) start and end of rollback segments 8) redo log archiving information 9) backup information 1.3.1 common operations on control files manage oracle control files mainly include: 1> control file backup www.2cto.com 2> Control File movement 3> Control File reconstruction 4> Control File Modification (rename database) 1.3.1.1 backup control files can be created in three ways: Create the backup control file alter database backup controlfile to 'C: \ controlfile01.ctl '; create an alter database backup controlfile to trace by creating a trace file; configure the automatic backup control file configure controlfile autobackup on in rman; 1.3.2.2 determine the location where the mobile control file is moved; start the database instance, startup mount or startup; If PFILE is used, modify the path of the control file; If SPFILE is used, then: alter system set control_files = 'path1, PATH2, PATH3 'scope = spfile; shut down the database shutdown immediate; physically move the control file to a new location; restart the database startup. 1.2.2.3 rebuilding the control file The following situations exist in www.2cto.com: 1) shutdown abort is lost in part of the control file; startup nomount is a control file that has not been lost in cp-p; alter database mount; alter database open; 2) If the control file is lost, if there is a backup in rman, you can use rman to recover the control file startup nomount; restore controlfile from autobackup; if there is no backup in rman, use the database backup control file to recreate the control file shutdown immediate; cp alter database mount; alter database open using backup controlfile; 3) use the tracking file to recreate www.2cto.com alter database backup contro Lfile to trace: edit the trace file and execute it using SQL; 4) manually create a control file (required information: database name, location and name of at least one member in each redo log, names and locations of all data files) create controlfile reuse database "PRDB" noresetlogs noarchivelog maxlogfiles 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 logfile group 1'/oracle/oradata/prdb/redo01.log 'SIZE 50 M, GROUP 2'/oracle/oradata/prdb/redo02.log 'SIZE 50 M, GROUP 3'/oracle/oradata/prdb/redo03.log' SIZE 50 M datafile '/oracle/oradata/prdb/system01.dbf', '/oracle/oradata/prdb/undotbs01.dbf', '/oracle/oradata/prdb/sysaux01.dbf ', '/oracle/oradata/prdb/users01.dbf'; www.2cto.com 1.3.2.4 rename the database alter database backup controlfile to trace; show parameter user_dump_dest select name, values from v $ parameter where name = 'user _ dump_dest '; cp ***. trc controlfile. SQL vi controlfile. SQL more controlfile. SQL CREATE CONTROLFILE set DATABASE "PRDB" resetlogs force logging archivelog maxlogfiles 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 logfile group 1'/oracle/oradata/prdb/redo01.log 'SIZE 50 M, GROUP 2'/oracle/oradata/prdb/redo02.log 'SIZE 50 M, GROUP 3'/oracle/oradata/prdb/redo03.log 'size 50 M datafile'/oracle/oradata/prdb/system01.dbf', '/oracle/oradata/prdb/undotbs01.dbf ', '/ora Cle/oradata/prdb/example ','/oracle/oradata/prdb/users01.dbf' character set ZHS16GBK; www.2cto.com shutdown immediate; perform full backup for the original database first; startup nomount; @ controlfile. SQL recover database alter database open restlogs; alter database rename global name to newdbname.mydomain.com; backup database; 1.3.2 parameter file (10g parameter file) is mainly used to record the database configuration file, when the database starts, Oracle reads the parameter file and configures the database according to the parameter settings in the parameter file. For example, memory pool allocation, number of processes allowed to be opened, and number of sessions. Two types of parameter files: pfile: parameter files of text files, which can be modified using vi, vim, and Other Editors. The file name is usually init <sid>. ora spfile: a binary parameter file, which cannot be directly modified. It can only be stored on the Oracle server. You can use EM or instructions to modify the priority level: www.2cto.com Oracle to start the order of reading parameter files, if no file exists, Oracle Reports the spfile <sid> error. ora --> spfile. ora --> init <sid>. ora parameter file path: spfle: $ ORACLE_HOME/dbs/spfile $ ORACLE_SID.ora pfile (9i): $ ORALCE_HOME/dbs/init $ ORALCE_SID.ora // 10g later, init is generally not used <sid>. ora pfile (10g): $ ORALCE_BASE/admin/$ ORACLE_SID/pfile // use www.2cto.com pfile: $ ORACLE_HOME/dbs/init only during database initialization. ora // default 1.3.3 password file function: it is mainly used to authenticate the password file for DBA permissions. For Linux: $ ORACLE_HOME/dbs/orapw <sid> Windows :: $ ORACLE_HOME/database/PW <sid>. orapw <sid> ---> orapw ---> Failure: 1. use orapwd to create and change the password file. 2. use alter user sys identified by <> 3. use grant sysdba to <> or grant sysoper to <> or revoke sysdba | sysoper from <>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.