1) create environment PERL5LIB, which works similar to the PATH environment variable
2) in the perl code, add:
BEGIN {unshift @INC, "/home/user/perl/modules/lib"};
3) in the perl code, add:
use lib '/home/user/perl/modules/lib';
BEGIN {unshift @INC, "/home/user/perl/modules/lib"};
use lib '/home/user/perl/modules/lib';
create or replace trigger logontrigger after logon on schemaAfter creating the logon trigger, log on as the user. If it does not generate a file in the user jump destination, then check the alert.log for errors.
declare
p_session_user varchar2(30);
p_host varchar2(200);
p_sql varchar2(230);
p_ip_address varchar2(30);
p_sessionid number(30);
begin
select translate(sys_context('userenv', 'host'), '-\ /', '____') into p_host from dual;
select sys_context('userenv', 'session_user') into p_session_user from dual;
select sys_context('userenv', 'sessionid') into p_sessionid from dual;
select sys_context('userenv', 'ip_address') into p_ip_address from dual;
-- Create trace file with a recognizable name.
p_sql:='alter session set tracefile_identifier=' || p_session_user || '_' || p_host;
execute immediate p_sql;
-- Choose one of the following trace levels. The second form provides bind variables and the result set.
p_sql:='alter session set sql_trace=true';
--select 'alter session set events ' || '''10046 trace name context forever, level 12''' into p_sql from dual;
execute immediate p_sql;
end;
/
show err
prompt
prompt Remember the user needs 'alter session' privilege.
prompt To remove: drop trigger logontrigger
spool outputFileName
prompt Include info here about defect tracking number, developer, etc.
-- On error rollback and exit. This is generally only needed for scripts that will be scheduled. For an ad-hoc migration, this is not needed.
whenever sqlerror exit failure rollback
whenever oserror exit failure rollback
-- Set the date format to avoid relying on defaults that are platform-specific.
alter session set nls_date_format='MM/DD/YYYY';
-- set echo on will print the SQL to the screen. This is optional and may not be useful if there is too much output.
set echo on
-- set define off will disable interpreting of the ampersand character.
set define off
-- Select the current time to show when script was implemented.
select systimestamp from dual;
-- set timing on will print elapsed time of each command.
set timing on
-- place script contents here.
UPDATE tablename set columna=value1;
-- spool off will stop logging to the output file.
spool off
ERROR at line 565:
ORA-00933: SQL command not properly ended