Showing posts with label SQL*PLUS. Show all posts
Showing posts with label SQL*PLUS. Show all posts

Monday, May 26, 2014

Unlock APEX admin user (when apxchpwd.sql doesn't work)

First we need to find the Apex admin accounts user_id. We do that with the following statement.
You might have two. Mine was the second one
select user_id from APEX_040200.WWV_FLOW_FND_USER where user_name = 'ADMIN' order by last_update_date desc;

Set a new password for the Apex Admin with the user_id we selected.
update APEX_040200.WWV_FLOW_FND_USER
set web_password = 'password'
where user_name = 'ADMIN'
and user_id = 56502607595642;
commit;

Then we unlock the Admin account with this statement.
alter session set current_schema = APEX_040200;
begin
wwv_flow_security.g_security_group_id := 10;
wwv_flow_fnd_user_api.UNLOCK_ACCOUNT('ADMIN');
commit;
end;

Wednesday, October 12, 2011

How to get command-line history in SQL*PLUS with rlwrap

sql*plus does not have a command-line history function under Linux and Unix.
rlwrap is a readline wrapper for shell commands which uses input from the controlling terminal.
It adds a persistent input history for each command and supports user-defined completion.

You can install it via yum if you have enabled the EPEL repository.
Or you can download the sources from here
Then open a terminal and go to the catalog you downloaded it to

If you have the EPEL repository enabled
Open a terminal
su - root
yum install rlwrap

Otherwise you do like this. Again in the folder you downloaded the file to.
Open a terminal
su - root
tar -zxvf rlwrap-0.37.tar.gz
./configure
make
make install

Now you can call sqlplus like this:
rlwrap sqlplus user/password@sid
I also recommend creating an alias like this
alias sqlp =”rlwrap sqlplus”
Now you can start the wrapped sqlplus with sqlp and have command history with the ↑ and ↓ keys on your keyboard.
Web Analytics