{"id":159,"date":"2008-10-01T22:00:00","date_gmt":"2008-10-01T20:00:00","guid":{"rendered":"http:\/\/antynet.pl\/index.php\/2008\/10\/01\/oracle-redologs\/"},"modified":"2010-08-24T22:45:04","modified_gmt":"2010-08-24T20:45:04","slug":"oracle-redologs","status":"publish","type":"post","link":"https:\/\/www.antynet.pl\/index.php\/2008\/10\/01\/oracle-redologs\/","title":{"rendered":"ORACLE REDOLOGS"},"content":{"rendered":"<p><span style=\"font-family: arial; font-weight: bold;\">add new group:<\/span><br \/><span style=\"font-family: arial;\">ALTER DATABASE ADD LOGFILE GROUP [nr] ('[file]&#8217;,'[file]&#8217;) size [size]M;<br \/>ALTER DATABASE ADD LOGFILE ('[file]&#8217;) size [size]M;<\/span><br \/><span style=\"font-family: arial; font-weight: bold;\">remove group (group must by inactive &#8211; check v$log)<\/span><span style=\"font-family: arial;\">:<\/span><br \/><span style=\"font-family: arial;\">ALTER DATABASE DROP LOGFILE GROUP [group_nr];<\/span><br \/><span style=\"font-family: arial; font-weight: bold;\">add file to group<\/span><span style=\"font-family: arial;\">:<\/span><br \/><span style=\"font-family: arial;\">ALTER DATABASE ADD LOGFILE MEMBER '[file]&#8217; TO GROUP [goup_nr];<\/span><br \/><span style=\"font-family: arial; font-weight: bold;\">remove file from group<\/span><span style=\"font-family: arial;\">:<\/span><br \/><span style=\"font-family: arial;\">ALTER DATABASE DROP LOGFILE MEMBER '[file]&#8217;;<\/span><br \/><span style=\"font-family: arial; font-weight: bold;\">turn on\/off archivelog (mount mode):<\/span><br \/><span style=\"font-family: arial;\">ALTER DATABASE ARCHIVELOG|NOARCHIVELOG;<\/span><br \/><span style=\"font-family: arial; font-weight: bold;\">force archivie and switch redolog:<\/span><br \/><span style=\"font-family: arial;\">ALTER SYSTEM ARCHIVE LOG CURRENT;<\/span><br \/>(mount mode)<br \/>ALTER SYSTEM ARCHIVE LOG GROUP [group_nr];<br \/><span style=\"font-family: arial; font-weight: bold;\">archivelog info:<\/span><br \/><span style=\"font-family: arial;\">ARCHIVE LOG LIST;<br \/><span style=\"font-weight: bold;\">switch redolog:<\/span><br \/>ALTER SYSTEM SWITCH LOGFILE;<br \/><span style=\"font-weight: bold;\">&nbsp;<\/span><\/span><br \/><span style=\"font-family: arial;\"><span style=\"font-weight: bold;\">force writing DIRTY BLOCKS from buffers (buffer cache) to datafile:<\/span><br \/>ALTER SYSTEM CHECKPOINT;<br \/>also for:<br \/>&#8211; change redologs(?)<br \/>&#8211; achieve LOG_CHECKPOINT_INTERVAL<br \/>&#8211; finish LOG_CHECKPOINT_TIMEOUT<br \/>&#8211; set ts of database in BACKUP mode<\/span><br \/><span style=\"font-family: arial;\">(SCN will be change only in header file of backup tablespace. During backup, in the other header files, SCN will be change normally without feedback with SCN in backup tablespace.<\/span><br \/><span style=\"font-family: arial;\">Tablespace after BACKUP mode adjust SCN to other files)<br \/>natomiast o ile zmiana redolog\u00f3w powoduje checkpoint to brak takiej zale\u017cno\u015bci w drug\u0105 stron\u0119<\/span><\/p>\n<p><span style=\"font-family: arial;\"><span style=\"font-weight: bold;\">checkpoint (write blocks from cache to files):<\/span><br \/>ALTER SYSTEM CHECKPOINT;<br \/>1a. SCN in logfiles not change<br \/>1b. SCN in header datafiles change<\/span><br \/><span style=\"font-family: arial;\">&nbsp;<\/span><br \/><span style=\"font-family: arial;\"> <span style=\"font-weight: bold;\">check files checkpoint and SCN:<\/span><br \/>SELECT file#,checkpoint_change;checkpoint_time FROM v$datafile_header;<br \/>to show SCN must be set SQLPLUS param:<br \/>set numwidth 18<br \/><span style=\"font-weight: bold;\">check current SCN (change every 3 sec.):<\/span><br \/>SELECT current_scn FROM v$database;<br \/>SELECT dbms_flashback.get_system_change_number FROM dual;<br \/><span style=\"font-weight: bold;\">set rolling grop of redologs:<\/span><br \/><\/span><code style=\"font-family: arial;\">ARCHIVE_LAG_TARGET=1800 (default 0)<\/code><\/p>\n<p><i><span style=\"font-family: arial;\">redolog is writing again only when data from it war written to datafiles and to archivelogs <br \/><\/span><\/i><span style=\"font-family: arial;\"><br \/><i><span style=\"font-weight: bold;\">switch redolog process:<br \/><\/span>ALTER SYSTEM SWITCH LOGFILE;<span style=\"font-weight: bold;\"><br \/><\/span>1a. new redolog group get status CURRENT witch current SCN,<br \/>1b. present redolog group get status ACTIVE it means that it is necessary to recover,<br \/>2a. oracle wait for finish writing data to datafile<\/i><\/span><br \/><span style=\"font-family: arial;\"><i> 2b. SCN in header files is changed(SELECT checkpoint_change# FROM v$datafile_header;) is equal SCN of current redolog group (SELECT first_change# FROM v$log;)<br \/>2c. present redolog group change status from ACTIVE to INACTIVE (SELECT * FROM v$log;)<\/i> <br \/><span style=\"font-weight: bold;\">check redolog load:<\/span><br \/><\/span>SELECT    le.leseq                        &#8222;Current log sequence No&#8221;,<br \/>100*cp.cpodr_bno\/le.lesiz       &#8222;Percent Full&#8221;,<br \/>cp.cpodr_bno                    &#8222;Current Block No&#8221;,<br \/>le.lesiz                        &#8222;Size of Log in Blocks&#8221;<br \/>FROM<br \/>x$kcccp cp,<br \/>x$kccle le<br \/>WHERE<br \/>le.leseq =cp.cpodr_seq<br \/>and bitand(le.leflg,24)=8;<br \/><span style=\"font-family: arial;\"><br \/>x$kcccp &#8211; kernel cache, controlfile checkpoint progress<br \/>x$kccle &#8211; kernel cache, controlfile logfile entry<br \/><\/span><\/p>\n<table class=\"tbl\">\n<tbody>\n<tr>\n<th>VIEWS<\/th>\n<\/tr>\n<tr>\n<td>V$LOG<\/td>\n<\/tr>\n<tr>\n<td>V$LOGFILE<\/td>\n<\/tr>\n<tr>\n<td>V$LOG_HISTORY<\/td>\n<\/tr>\n<tr>\n<td>V$ARCHIVE_DEST<\/td>\n<\/tr>\n<tr>\n<td>V$ARCHIVED_LOG<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>add new group:ALTER DATABASE ADD LOGFILE GROUP [nr] ('[file]&#8217;,'[file]&#8217;) size [size]M;ALTER DATABASE ADD LOGFILE ('[file]&#8217;) size [size]M;remove group (group must by inactive &#8211; check v$log):ALTER DATABASE DROP LOGFILE GROUP [group_nr];add file to group:ALTER DATABASE ADD LOGFILE MEMBER '[file]&#8217; TO GROUP [goup_nr];remove file from group:ALTER DATABASE DROP LOGFILE MEMBER '[file]&#8217;;turn on\/off archivelog (mount mode):ALTER DATABASE ARCHIVELOG|NOARCHIVELOG;force [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[80],"tags":[78],"class_list":["post-159","post","type-post","status-publish","format-standard","hentry","category-oracle","tag-oracle-redologs"],"_links":{"self":[{"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/posts\/159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/comments?post=159"}],"version-history":[{"count":1,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/posts\/159\/revisions"}],"predecessor-version":[{"id":216,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/posts\/159\/revisions\/216"}],"wp:attachment":[{"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/media?parent=159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/categories?post=159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/tags?post=159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}