Search code examples
sql-serveroracle-databaselinked-serverchange-password

Change password in ORACLE from SQL Server via linked server


I have an Oracle database connected to a SQL Server. The connection works correctly, but unfortunately, I don't know the password used for that connection. Now I need to change the password in Oracle.

Is it a good idea to run something like

SELECT * FROM OPENQUERY([oracle], '
     ALTER USER OracleUser IDENTIFIED BY pswd;
     SELECT 1 FROM DUAl')

Or maybe, is there another solution?

UPD My query ends with error

The OLE DB provider "OraOLEDB.Oracle" for linked server "oracle" indicates that either the object has no columns or the current user does not have permissions on that object


Solution

  • Correct syntax for changing password in Oracle from SQL Server via linked server is

    EXEC ('ALTER USER OracleUser IDENTIFIED BY new_password REPLACE old_password') AT [oracle]