0

Hope you are doing well ... I am facing an issue in oracle forms where i would like to write following code But I feel that it is not connecting to system and do not drop user... I have checked it to get login with current user

DECLARE
    V_USR VARCHAR2(20):=NULL;
    V_PWD VARCHAR2(20):=NULL;
BEGIN
    V_USR := USER;
    V_PWD := GET_APPLICATION_PROPERTY(PASSWORD);
IF :PATH IS NULL THEN
        MESSAGE('Please select backup file to import.');
        MESSAGE('Please select backup file to import.');
        RAISE FORM_TRIGGER_FAILURE;
END IF;
LOGOUT;
LOGON('SYSTEM','MANAGER@ORC');
FORMS_DDL('DROP USER '||V_USR||' CASCADE');
FORMS_DDL('CREATE USER '||V_USR||' IDENTIFIED BY '||V_PWD);
FORMS_DDL('GRANT ALL PRIVILEGES TO '||V_USR);
FORMS_DDL('GRANT DBA TO '||V_USR);
host('imp userid='||V_USR||'/'||V_PWD||' fromuser='||V_USR||' touser='||V_USR||' file = '||:path||' log=d:\import_log.txt');
LOGOUT;
LOGON(V_USR,V_PWD||'@'||'ORC');
NEXT_ITEM;
END;

Waiting for your kind response

1 Answer 1

0

But I feel that it is not connecting to system

LOGON('SYSTEM','MANAGER@ORC');

Indeed. Database name goes along with username, not password.

For example:

SQL> connect scott@pdb1       --> see? with username
Enter password:
Connected.
SQL>

so I'd try LOGON('SYSTEM@ORC','MANAGER') (the same goes at the end of script you posted, when you're logging in as newly created user).


By the way, that's a really powerful user, with all privileges and DBA role as well. Are you sure-sure you want to do that?

Sign up to request clarification or add additional context in comments.

1 Comment

I hv tried it with LOGON('SYSTEM@ORC','MANAGER') But it is not working and showing error in attachment/log file Please help to resolve it ... Remember one thing I am running this form with scott/tiger user User scott is dropped and created new one and give privileges DBA then import db dump file .. pls guide

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.