Oradim for Oracle 18c not working on Windows Server 2016 - windows

I installed Oracle 18c on a Windows Server 2016 VM with the following options: Software only, single instance database, Standard edition 2, Use virtual account.
When I try to run ORADIM command to create a database, the command never returns control to the prompt and I have to close it forcedly.
There aren't any error messages in oradim log file, the instance has been created as well as all the related Oracle Services.
The only error I was able to find in Windows Event Viewer is related to Oracle VSS Writer service:
"Volume Shadow Copy Service error: The process that hosts the writer with name Oracle Vss Writer - XXXX and ID {yyy} does not run under a user with sufficient access rights. Consider running this process under a local account which is either Local System, Administrator, Network Service or Local Service."
My understanding is that ORADIM command is not returning because the Vss service start fails, can someone confirm thiscould be the case? Is ORADIM command compatible with virtual user installation and what do I need to do to have it working?

If this is a test database then:
Create a local or domain user for this Oracle instance such as Ora
Add this user to the ora_dba group in the local windows groups and users
Change the account the Oracle database and VSS Writer Service runs under (if they exist at this stage of the install) to this account
Run OraDim again using this account

I was able to confirm that oradim command freezes because of the Oracle Vss Service start failure: I launched the oradim command, as soon as the Oracle Vss Writer Service was created I modified the associated Log On user to LocalService and started the service, oradim command immediately returned control to the command window.
Thus I came up with this workaround in my installation script that seems to work, although I suppose there might be a better solution:
start oradim -new -sid %ORACLE_SID% -startmode manual
SET ORACLEVSS_NAME=OracleVssWriter%ORACLE_SID%
:VSSSRVCLOOP
SC QUERY %ORACLEVSS_NAME% > NUL
IF NOT ERRORLEVEL 1060 GOTO SVCCREATED
TIMEOUT 5 > NUL
GOTO VSSSRVCLOOP
:SVCCREATED
net stop %ORACLEVSS_NAME%
SC CONFIG %ORACLEVSS_NAME% obj= "NT AUTHORITY\LocalService" password= ""
net start %ORACLEVSS_NAME%

Related

Oracle XE 18c rename SID [duplicate]

I needed to change the SID of an Oracle XE database (not the Service Name) to match a production database.
When I tried searching online, most of the pages were describing changing or adding a service name through tnsnames.ora; that's not what I needed to do.
The asktom article has the answer, but the formatting and verbosity makes it hard to follow, so here's a summary:
[XE_HOME] means where Oracle XE is installed. Normally this is C:\oraclexe\app\oracle\product\10.2.0\server.
Make sure you have Administrator privileges or the procedure will fail.
Configure the SPFILE (you can remove the old file if you want)
copy [XE_HOME]\dbs\spfileXE.ora [XE_HOME]\dbs\spfileNEW_SID_NAME.ora
copy [XE_HOME]\database\initXE.ora [XE_HOME]\database\initNEW_SID_NAME.ora
Edit [XE_HOME]\database\initNEW_SID_NAME.ora: It should contain a single line like this: SPFILE='[XE_HOME]\server\dbs/spfileNEW_SID_NAME.ora'
Shutdown and replace the old service with a new:
sqlplus / as sysdba and execute shutdown
lsnrctl stop
oradim -new -sid NEW_SID_NAME -startmode auto -pfile [XE_HOME]\database\initNEW_SID_NAME.ora
oradim -delete -sid XE
lsnrctl start
Update the ORACLE_SID environment property (System Settings > Advanced > Environment)
Force Oracle to register with listener
sqlplus / as sysdba and execute alter system register;
You can verify that the SID was changed by executing the following query: select instance_name from v$instance;
I had some problems with the solution posted by Johannes, so I had to do some extra steps.
When trying to connect to oracle (step 4) by doing sqlplus / as sysdba I got:
ERROR: ORA-12560: TNS:protocol adapter error
The solution for this was executing the following line:
oradim -start -sid NEW_SID_NAME
Then connecting with / worked fine, but trying to connect to NEW_SID_NAME with system or HR got me another problem:
ERROR: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
I checked that with the query select instance_name from v$instance; that the listener would be NEW_SID_NAME, and so did. But running lsnrctl status in the command line or querying select name from dba_services; didn't show NEW_SID_NAME as a listener.
The solution of this problem was executing the followind sentence on sqlplus:
alter system set service_names='NEW_SID_NAME';
Maybe you'll need to execute alter system register; after this also.
After doing this two steps I can connect to the NEW_SID_NAME with system and HR.
Hope it helps
In version 11g, all of the previous solution didn't work... I always get the following error when trying to do the sqlplus / as sysdba :
ERROR: ORA-12560: TNS:protocol adapter error
Luckily I found a script to do what I wanted to do under [XE_HOME]\config\scripts. The script is named XE.bat and it will instantiate a new database from scratch asking you for the sysPassword along the process. So what I did was :
Stop and remove the existing service if any:
oradim -delete -sid XE
Stop the listener
Configure the SPFILE as explained by Johannes
Make a copy of the script XE.bat, you can name it whatever you want
Edit the copy of the script as follows :
Change line "set ORACLE_SID=XE" to "set ORACLE_SID=NEW_SID_NAME"
Change wherever you see "-sid XE" to "-sid NEW_SID_NAME"
Update the line where it calls the "orapwd.exe" command to point to a file called PWDNEW_SID_NAME.ora instead of PWDXE.ora
Update the line that echos the spfileXE.ora into the initXE.ora to echo spfileNEW_SID_NAME.ora into initNEW_SID_NAME.ora (this part may render the step 3 useless but I prefer to do it anyway, just in case...)
Execute the script... It will prompt you for the SYSTEM password a few times saying
Enter value for 1:
or
Enter value for 2:
That's it, the new database with your NEW_SID_NAME is up and running!!

Oracle 11g XE - Can't login and database is down

Just installed Oracle 11g XE (Windows), but can't connect in SQL Developer or run any command in CLI.
When try to connect in CLI using SYS or SYSTEM with password defined during the install, get the following error:
ORA-12638: credential retrieval failed
When I tray to connect via SQL Developer (tried via SID and Service Name, hostname=localhost, port=1521, SID=xe), get this error:
Status : Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in
connect descriptor
Already tried change SQLNET.AUTHENTICATION_SERVICES = (NTS) to (NONE) in sqlnet.ora file. When I do this, get the following error when try to connect with the SYS or SYSTEM user and password:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Already tried every solution in Google results, like reinstall, stop and start services... Mostly ask for first connect in CLI to make some changes, but even this I can't accomplish.
Any suggestions on how connect to the database?
Found the solution:
I was installing in my company Windows user domain.
First uninstall any instance of Oracle XE 11g.
Switch to a local administrator Windows user and install Oracle XE 11g.
Sign off and back to company Windows user.
Edit the file C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\sqlnet.ora (or equivalent to your installation path). Change SQLNET.AUTHENTICATION_SERVICES = (TNS) to SQLNET.AUTHENTICATION_SERVICES = (NONE).
This change will allow you connect to database from you company Windows user.
As seen here: Error ORA-12638 in Oracle Database 11g
Try the following: Open command window, cd to Oracle bin directory, enter sqlplus /nolog. If you get a prompt enter connect / as sysdba. If you get connected then you can try "startup".
- -
Did you try to start the Oracle RDBMS service via Services (services.msc)?
Do you use an spfile? Check the registry for ORA_SID_NAME_PFILE that is different from default location of $ORACLE_HOME/dbs. Also check the default location. Use only the default location or the registry entry removing either the registry entry or the file in the default location depending on which you want to use.

Execution of postgresql by a user with administrative permissions is not permitted

Win7. Postgres 9.3.
Every time I type "postgres" in cmd I get this error.
Created a new account without any admin rights and with "Log on as" rights and with correct directory access rights to postgres/data, then I set this account as the "Log on as" in the services menu, but I still get the same error.
update2017: I never found a solution to this.
For windows do this:
Start cmd.exe (administrator as you are)
Add postgres user:
net user postgres your_password /add
Start a cmd.exe using your new postgres account:
runas /user:postgres cmd.exe
You can validate you are login correctly using" whoami
Run postgres normally.
It is not clear from your question whether you are trying to start the Postgres service or "manually" start Postgres without having a Windows service registered.
Since 9.x Postgres does not require it's own Windows user account to run the service. It defaults to use the built-in "Network" account.
To start the Postgres service (if it has been correctly installed), simply use use
net start postgresql-9.3
(the actual name might be different)
If you did not register a Windows service you should start Postgres through pg_ctl.exe not through postgres.exe. pg_ctl.exe will drop any administrative privileges from the process when starting the server.
To start Postgres manually from the commandline use:
pg_ctl -w -D c:\Path\To\The\DataDirectory
assuming that the access rights to the data directory are setup correctly so that the current user has full access to the directory.
If you want to install/create the Windows service manually, you can also do this through the pg_ctl program:
pg_ctl register -N "postgresql-9.3" -D c:\Path\To\The\DataDirectory
Again the access rights to the data directory must be setup correctly.

oracle listener supports no service

I am having trouble with my Oracle instance.
I get the following error when I run lsnrctl stat in command prompt. I even confirmed Oracle services running.
The listener supports no services.
I assume the platform is Windows and the Oracle version is 11g.
When an Oracle database instance starts, it tries to register itself to the default listener or to the listener registered in the init parameters as the local_listener. What you can do is
make sure that your local_listener parameter points to your listener
make sure that your listener runs on localhost port 1521 (using the listener.ora file)
This is when the database is using a dynamic listener. You could also make the listener a static one by entering the instance details in the listener.ora file. Docu about the listener.ora is found here Oracle Net Listener Parameters (listener.ora)
when the listener is created after creation of database,we need to explicitly register our instance.
try:
starting database by doing startup and check the listerner status by lsnrctl status and it your instance is running it means pmon has done registering your instance with the listener itself.
A solution is very simple for this error, first, let's understand why this error occurs. It basically has two reasons which are:
1) Your database and service name is not properly set in Oracle environment it should be same everywhere check below parameter values
-ORACLE_SID in oracle environment.
-Check Database Instance name.
-SID_NAME in tnsnames.ora file.
-SERVICE_NAME in listener.ora file.
2) Host name/IP address is missing, not correct or spelling mistake, so please check the below.
-Check the IP ADDRESS in /etc/hosts file.
-It should be same in listener.ora and tnsnames.ora file
-And it should be able to ping from the local and remote server.
Now see I've also faced the same problem and resolved:
please visit this StackOverflow link:
https://stackoverflow.com/a/45065640/6332029
I hope it will help, thanks!
In my case it was easy - for some reason, after restarting my laptop, services stopped working.
So, Run > services > start OracleService helped to start the listener
I had this problem with the latest Oracle 19c version with CentOS 8 installation.
So there is a bug with this Oracle DB instance.
What happens: When you install the ORACLE DB, it automatically creates the listener with an instance. The problem exist in the Hierarchy File System of Linux and how the permission is distributed between the Sudo User group and the non-oracle User.
What you have to do :
Okay to solve this, you have to open your bash profile
***nano ~/.bash_profile***
this is equivalent to environment variables in Windows.
write text in editor: export ORACLE_HOME=/u01/app/oracle/product/{oracle-version}/dbhome_1
Save & Exit
Execute: export ORACLE_HOME=/u01/app/oracle/product/{oracle-version}/dbhome_1
test the environment variable :
Echo $ORACLE_HOME -- should display result
execute chmod 777 /home
execute chown -R oracle /home
open terminal su oracle && cd /u01/app/oracle/product/{oracle-version}/dbhome_1/bin
with oracle account execute ./lsnrctl start -- it should run with no services still
execute: su {root account} && sudo ./dbstart
it should run run with 1 or 2 error.. its fine as long as it doesn't say "ORACLE_HOME is not set"
go back to execute: su oracle && ./lsnrctl status with non root account
That's it.. it should now connect with your service and handler, should give the instance of your db name to connect with. You can use the sys as sysdba and password during installation to log into the database.
After starting the listener service I had to wait 60 seconds before the services would show up as running. So if you enter "lsnrctl stop" followed by "lsnrctl start" you might have to wait a minute before "lsnrctl status" will show your listener services.
I did check all the things but could not find the cause. So I re-installed the Oracle and using that now.

How can I change the SID of an Oracle XE instance

I needed to change the SID of an Oracle XE database (not the Service Name) to match a production database.
When I tried searching online, most of the pages were describing changing or adding a service name through tnsnames.ora; that's not what I needed to do.
The asktom article has the answer, but the formatting and verbosity makes it hard to follow, so here's a summary:
[XE_HOME] means where Oracle XE is installed. Normally this is C:\oraclexe\app\oracle\product\10.2.0\server.
Make sure you have Administrator privileges or the procedure will fail.
Configure the SPFILE (you can remove the old file if you want)
copy [XE_HOME]\dbs\spfileXE.ora [XE_HOME]\dbs\spfileNEW_SID_NAME.ora
copy [XE_HOME]\database\initXE.ora [XE_HOME]\database\initNEW_SID_NAME.ora
Edit [XE_HOME]\database\initNEW_SID_NAME.ora: It should contain a single line like this: SPFILE='[XE_HOME]\server\dbs/spfileNEW_SID_NAME.ora'
Shutdown and replace the old service with a new:
sqlplus / as sysdba and execute shutdown
lsnrctl stop
oradim -new -sid NEW_SID_NAME -startmode auto -pfile [XE_HOME]\database\initNEW_SID_NAME.ora
oradim -delete -sid XE
lsnrctl start
Update the ORACLE_SID environment property (System Settings > Advanced > Environment)
Force Oracle to register with listener
sqlplus / as sysdba and execute alter system register;
You can verify that the SID was changed by executing the following query: select instance_name from v$instance;
I had some problems with the solution posted by Johannes, so I had to do some extra steps.
When trying to connect to oracle (step 4) by doing sqlplus / as sysdba I got:
ERROR: ORA-12560: TNS:protocol adapter error
The solution for this was executing the following line:
oradim -start -sid NEW_SID_NAME
Then connecting with / worked fine, but trying to connect to NEW_SID_NAME with system or HR got me another problem:
ERROR: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
I checked that with the query select instance_name from v$instance; that the listener would be NEW_SID_NAME, and so did. But running lsnrctl status in the command line or querying select name from dba_services; didn't show NEW_SID_NAME as a listener.
The solution of this problem was executing the followind sentence on sqlplus:
alter system set service_names='NEW_SID_NAME';
Maybe you'll need to execute alter system register; after this also.
After doing this two steps I can connect to the NEW_SID_NAME with system and HR.
Hope it helps
In version 11g, all of the previous solution didn't work... I always get the following error when trying to do the sqlplus / as sysdba :
ERROR: ORA-12560: TNS:protocol adapter error
Luckily I found a script to do what I wanted to do under [XE_HOME]\config\scripts. The script is named XE.bat and it will instantiate a new database from scratch asking you for the sysPassword along the process. So what I did was :
Stop and remove the existing service if any:
oradim -delete -sid XE
Stop the listener
Configure the SPFILE as explained by Johannes
Make a copy of the script XE.bat, you can name it whatever you want
Edit the copy of the script as follows :
Change line "set ORACLE_SID=XE" to "set ORACLE_SID=NEW_SID_NAME"
Change wherever you see "-sid XE" to "-sid NEW_SID_NAME"
Update the line where it calls the "orapwd.exe" command to point to a file called PWDNEW_SID_NAME.ora instead of PWDXE.ora
Update the line that echos the spfileXE.ora into the initXE.ora to echo spfileNEW_SID_NAME.ora into initNEW_SID_NAME.ora (this part may render the step 3 useless but I prefer to do it anyway, just in case...)
Execute the script... It will prompt you for the SYSTEM password a few times saying
Enter value for 1:
or
Enter value for 2:
That's it, the new database with your NEW_SID_NAME is up and running!!

Resources