{"id":353,"date":"2024-07-26T07:52:29","date_gmt":"2024-07-26T07:52:29","guid":{"rendered":"https:\/\/humtechno.com\/intro\/?p=353"},"modified":"2024-07-26T07:54:02","modified_gmt":"2024-07-26T07:54:02","slug":"oracle-flash-database","status":"publish","type":"post","link":"https:\/\/humtechno.com\/intro\/2024\/07\/26\/oracle-flash-database\/","title":{"rendered":"Oracle Flash Database"},"content":{"rendered":"\n\n\n\n<p>Flashback Database is to rewind the database to a target time, its usually much faster than a RESTORE operation followed by point-in-time recovery because no data files are restored.<\/p>\n\n<p><strong>For Enable Flasback in Database<br><\/strong>Database should be in Archive Mode<br>show parameter db_recovery_file_dest;<br>alter system set db_recovery_file_dest = &#8216;\/data\/fastrecoveryarea&#8217;;<br>alter system set db_recovery_file_dest_size=300g;<br>select flashback_on from v$database;<br>alter database flashback on;<br>select flashback_on from v$database;<\/p>\n\n<p><strong>Flash back Retention<\/strong><\/p>\n\n<p>How far back one can flashback a database depends on how much flashback data Oracle has kept in the fast recovery area<\/p>\n\n<p>alter system set DB_FLASHBACK_RETENTION_TARGET = 1440;<\/p>\n\n<p><strong>Check SCN from Database<br><\/strong>SELECT current_scn, TO_CHAR(SYSTIMESTAMP, &#8216;YYYY-MM-DD HH24:MI:SS&#8217;) FROM v$database;<\/p>\n\n<p><strong>Check Usage of Flash Recovery Area<br><\/strong>select * from v$flash_recovery_area_usage;<\/p>\n\n<p><strong>Check Available in Recovery Destination Area<br><\/strong>select name, floor(space_limit \/ 1024 \/ 1024\/1024) &#8220;Size GB&#8221;, ceil(space_used \/ 1024 \/ 1024\/1024) &#8220;Used GB&#8221; from v$recovery_file_dest order by name;<\/p>\n\n<p><strong>Check Transaction Query Inside Flash Logs or what exactly store in flashback<\/strong><\/p>\n\n<p>SELECT operation, undo_sql, table_name,COMMIT_TIMESTAMP<br>FROM flashback_transaction_query;<\/p>\n\n<p>SELECT table_name, count(*)<br>FROM flashback_transaction_query group by table_name;<\/p>\n\n<p><strong>Disable Flashback Database<br><\/strong>alter database flashback off;<\/p>\n\n<p><strong>Flashback database to Specific Time<br><\/strong>sqlplus \/ as sysdba<br>shutdown immediate<br>startup mount exclusive<br>flashback database to timestamp sysdate-(1\/24\/12);<br>alter database open resetlogs;<\/p>\n\n<p><strong>More Flashback Database Options<br><\/strong>flashback database to timestamp {my_date};<br>flashback database to before timestamp {my_date};<br>flashback database to scn {my_scn};<br>flashback database to before scn {my_scn};<\/p>\n\n<p><strong>Flashback Database to Specific Restore Point<\/strong><\/p>\n\n<p>flashback database to restore point before_changes;<\/p>\n\n<p><strong>Enable Flashback Table<\/strong><\/p>\n\n<p>CREATE TABLE flashback_table_test (<br>id NUMBER(10)<br>);<br>ALTER TABLE flashback_table_test ENABLE ROW MOVEMENT;<\/p>\n\n<p><strong>Flashback Tables<\/strong><\/p>\n\n<p>FLASHBACK TABLE flashback_table_test TO SCN 715315;<br>FLASHBACK TABLE flashback_table_test TO TIMESTAMP TO_TIMESTAMP(&#8216;2004-03-03 10:00:00&#8217;, &#8216;YYYY-MM-DD HH:MI:SS&#8217;);<\/p>\n\n<p><strong>Flashback Query for Table Data<\/strong><\/p>\n\n<p>SELECT COUNT(*)<br>FROM flashback_query_test AS OF TIMESTAMP TO_TIMESTAMP(&#8216;2004-03-29 13:34:12&#8217;, &#8216;YYYY-MM-DD HH24:MI:SS&#8217;);<\/p>\n\n<p>SELECT COUNT(*)<br>FROM flashback_query_test AS OF SCN 722452;<\/p>\n\n<p><strong>Emergency Cleanup Flashback Logs<\/strong><\/p>\n\n<p>SELECT operation, undo_sql, table_name,COMMIT_TIMESTAMP FROM flashback_transaction_query;<\/p>\n\n<p>alter database flashback off;<\/p>\n\n<p>alter database flashback on;<\/p>\n\n<p><\/p>\n\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":333,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"pagelayer_contact_templates":[],"_pagelayer_content":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-353","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oracle"],"_links":{"self":[{"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/posts\/353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/comments?post=353"}],"version-history":[{"count":5,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/posts\/353\/revisions"}],"predecessor-version":[{"id":358,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/posts\/353\/revisions\/358"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/media\/333"}],"wp:attachment":[{"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/media?parent=353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/categories?post=353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/tags?post=353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}