Search code examples
oraclespecial-charactersalter-tableuser-accounts

In Oracle, How do I alter a user that have a special character in the name?


I am using Oracle 11g and I need to unlock an specific user but this user have a dot in the name.For Example lets say my user name is 'foo.mock'. I know that adding this kind of characters in user names is not a good practice but I dont administrate the database.

So I tried with

Alter user foo.mock account unlock;

and with

Alter user 'foo.mock' account unlock;

and also tried to save the name in a variable and then use that variable in alter query but nothing worked.

Any Idea how to do this?


Solution

  • You can enclose it in double quotes, but you need to match the case from dba_users, which is usually uppercase but may not be if it was created quoted:

    alter user "FOO.MOCK" account unlock;
    

    Read more about quoted and non-quoted identifiers.