laravel-oci8
laravel-oci8 copied to clipboard
How to connect to Oracle using SYS AS SYSDBA
Summary of problem or feature request
How do I connect to Oracle database using SYS AS SYSDBA username in config/database.php file
Code snippet of problem
as I tried using 'username' => 'SYS /AS SYSDBA', 'password' => 'my sys password',
again tried in various forms but it gives following error.. Oci8Exception ORA-28009: connection as SYS should be as SYSDBA or SYSOPER
kindly provide with dummy/test config/database.php using SYS username Thanks
System details
- Operating System : Windows 10 Pro 64 bit
- PHP Version : 7.3.12
- Laravel Version : 5.4
- Laravel-OCI8 Version : 5.4
Sorry for late response, I personally haven't tried this yet. Were you able to solve this?
I ran into this same issue when trying to connect to a fresh local Oracle database in a Docker container. I was able to get past the issue mentioned above by setting the username to 'SYS AS SYSDBA', but then I was getting the invalid username/password error (ORA-01017). It turns out that when you are trying to connect to a database using oci8 with the sys user, you need to do a few things:
- Enable privileged connections in the php.ini file (oci8.privileged_connect = On)
- Use 'SYS' as the username (no need for 'SYS AS SYSDBA' here)
- In the oci_connect function, pass in the session_mode argument as OCI_SYSDBA or OCI_SYSOPER
See the session_mode parameter in the PHP docs for more info about this: https://www.php.net/manual/en/function.oci-connect.php
Now I'm just not sure if it is currently possible to set the session_mode using this packages interface
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 7 days since being marked as stale.