AWK Scripts

Extract SQL Statements from export dump file

// { N=0; } /^CONNECT/ { N=0; } /^CREATE SYNONYM / { N=0; } /^CREATE SEQUENCE / { N=0; } /^CREATE DATABASE LINK / { N=0; } /^CREATE TABLE / { N=0; } /^CREATE INDEX / { N=0; } /^ALTER / { N=0; } /^ANALYZE / { N=0; } /^GRANT / { N=1; } /^AUDIT…

Indexfile beautifier (reformats indexfiles produced by ‘imp indexfile=’)

BEGIN { index_file=”create_index.sql”; print “REM Generated automatically” >index_file; print “SET TRIMSPOOL ON TIMING ON” >index_file; print “ALTER SESSION SET SORT_AREA_SIZE=102400000;” >index_file; print “SPOOL create_index.log” >index_file; print “” >index_file; table_file=”create_table.sql”; print “REM Generated automatically” >table_file; print “SET TRIMSPOOL ON TIMING ON” >table_file; print “SPOOL create_table.log” >table_file; print “” >table_file; trash_file=”create_trash.sql”; print “REM Generated automatically” >trash_file; current_file=trash_file;…