1

Is there a SQL script I could run, or some other action I could take, that would create an alias for an entire DB User? I'm running in to an issue where the User name text is too long for a particular program, and I want to create an alias or nickname for that UserId.

Edits:

Rather than logging in with UserId: , Password , I want to log in with UserId: , Password.

The program is not under my control beyond chaning the oracle User ID / Password login credentials.

Stealth Rabbi
  • 10,156
  • 22
  • 100
  • 176

2 Answers2

3

Perhaps you can use a proxy user that can connect to the DB on behalf of the longNamed user:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::p11_question_id:21575905259251

Actually, if it's only for login purpose then maybe you can use Secure External Password Store and avoid putting any username/password

A.B.Cade
  • 16,735
  • 1
  • 37
  • 53
2

You can't create an alias for a database user, no.

Perhaps you don't need to, though. If A (the user with the long name) owns a number of objects, you can create a new database user B with a short name, grant B privileges on the objects in A, and then change the current_schema when B logs in so that references to objects are resolved using A's schema

ALTER SESSION
  SET current_schema = A;

That should accomplish most of what the alias would provide.

Justin Cave
  • 227,342
  • 24
  • 367
  • 384
  • That's a good idea. Unfortunately, the application managing the oracle connections is limited to me changing the userid / password, so it won't work in my particular case. This is a good answer though. – Stealth Rabbi Feb 21 '12 at 17:04
  • 1
    @StealthRabbi - You can always create a login trigger in schema B that runs the `ALTER SESSION` to set the `current_schema` to A. – Justin Cave Feb 21 '12 at 17:05