Monday, February 27, 2012

How to kill data Pump Job


Import> STOP_JOB=IMMEDIATE

or

Export>STOP_JOB=IMMEDIATE

also u can use this script

DECLARE
job_1 NUMBER;
BEGIN
job_1 := DBMS_DATAPUMP.ATTACH('JOB_NAME','SYSTEM');
DBMS_DATAPUMP.STOP_JOB (job_1,1,0);
END;

Wednesday, February 22, 2012

How to fix special characters using for subject with utl_mail

use utl_encode.MIMEHEADER_ENCODE with subject like example below...

utl_encode.MIMEHEADER_ENCODE('TEST MAIL..!!! ')||p_subject
view raw utl_encode.sql hosted with ❤ by GitHub

Wednesday, February 15, 2012

ora-01720

Problem can be solved by giving privilege with  " WITH GRANT OPTION" ;

Monday, February 13, 2012

How to fix asm discs' confusion for multipath RAC

First of all delete all disks from diskgroup
/usr/sbin/oracleasm deletedisk DISK1
then
clear asm disk headers
dd if=/dev/zero of=/dev/mapper/mpath0p1 bs=8192 count=12800
reconfigure asm disks
/usr/sbin/oracleasm configure -i
and scandisk again
/usr/sbin/oracleasm scandisks
recreate asm disks
/usr/sbin/oracleasm createdisk DISK1 /dev/mapper/mpath0p1
last thing , you have to reconfigure asm disks on other node
/usr/sbin/oracleasm configure -i
thats it..

Wednesday, February 8, 2012

easy way of giving all privileges to an user from main database to another database

 select  'grant ' || privilege || ' on ' || grantor || '.' || table_name || ' to ' || grantee || ';' from dba_tab_privs where grantee='SCHEMA_NAME'

UTL_MAIL INSTALLATION AND ADDING INTO ACL

cd $ORACLE_HOME
cd rdbms/admin/
sqlplus / as sysdba

SQL> @utlmail.sql
then
SQL> @prvtmail.plb

SQL> GRANT EXECUTE ON UTL_MAIL TO PUBLIC;
-or-
SQL> GRANT EXECUTE ON UTL_MAIL TO system;

SQL>ALTER SYSTEM SET smtp_out_server = 'mail.srv' SCOPE=BOTH;

SQL>shutdown immediate;
SQL>startup;


when database is ready execute the below scripts to create and give privlages;
begin
  dbms_network_acl_admin.create_acl (
    acl         => 'utl_mail.xml',
    description => 'Allow mail to be send',
    principal   => 'SCOTT',
    is_grant    => TRUE,
    privilege   => 'connect'
    );
    commit;
end;

giving privilage;
begin
  dbms_network_acl_admin.add_privilege (
  acl       => 'utl_mail.xml',
  principal => 'SCOTT',
  is_grant  => TRUE,
  privilege => 'resolve'
  );
  commit;
end;
last step ;
assing ACL
begin
  dbms_network_acl_admin.assign_acl(
  acl  => 'utl_mail.xml',
  host => 'smtp server host name or address'
  );
  commit;
end;

Now u can send mail with ult_mail...

begin
  utl_mail.send(
  sender     => 'person@com.tr',
  recipients => 'person2@com.tr',
  message    => 'hi'
  );
  commit;
end;

if u wanna see who can send mail with UTL_MAIL ;

select owner, object_type from all_objects where object_name = 'UTL_FILE' ;

Thursday, February 2, 2012

Removing and Adding Send Mail Service at boot for linux

to remove
chkconfig --del sendmail
to add
chkconfig --add sendmail
to control
chkconfig --list sendmail