Oracle won't start up for me now - oracle

I'm trying to login to Oracle, it prompts for a username and password,
but I'm getting this error
A-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Process ID: 0
Session ID: 0 Serial number: 0
What should I do?.Thanks in advance

For me it looks like either your environment is not set correctly
i.e. the ORACLE_HOME and ORACLE_SID environment parameters are not set,
or the database has an issue.
Please check which of both, report it, so we could help you.
to check environment parameters
echo $ORACLE_HOME
echo $ORACLE_BASE
if any of them is not correct - change them to the right content - log in, and enjoy your DB.
If they're correct - check if Oracle process exists on the system
ps -ef | grep oracle

Related

PostgreSQL Installation Error: The environment variable COMSPEC does not seem to point to the cmd.exe

I am new to PostgreSQL and when I tried to install PostgreSQL 13 / 14 on my Windows 10 device I encountered the following error.
"The environment variable COMSPEC does not seem to point to the cmd.exe or there is a training semicolon present. Please fix this variable and restart installation."
The screenshot of the pop up error
COMSPEC System Variable
This is the setting of my COMSPEC environment variable
The Content of the installbuilder_installer.log
Log started 05/06/2022 at 17:51:52
Preferred installation mode : qt
Trying to init installer in mode qt
Mode qt successfully initialized
Setting variable whoami from C:\WINDOWS\System32\whoami
Script exit code: 0
Script output:
atrapa\junkwong
Script stderr:
Executing C:\WINDOWS\System32\icacls "C:\Users\junkwong\AppData\Local\Temp/postgresql_installer_c7c2d91f40" /inheritance:r
Script exit code: 0
Script output:
processed file: C:\Users\junkwong\AppData\Local\Temp/postgresql_installer_c7c2d91f40
Successfully processed 1 files; Failed processing 0 files
Script stderr:
Executing C:\WINDOWS\System32\icacls "C:\Users\junkwong\AppData\Local\Temp/postgresql_installer_c7c2d91f40" /T /Q /grant "atrapa\junkwong:(OI)(CI)F"
Script exit code: 0
Script output:
Successfully processed 1 files; Failed processing 0 files
Script stderr:
Executing C:\WINDOWS\System32\cscript //NoLogo "C:\Users\junkwong\AppData\Local\Temp\postgresql_installer_c7c2d91f40\prerun_checks.vbs"
Script exit code: 0
Script output:
The scripting host appears to be functional.
Script stderr:
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 Base Directory. Setting variable iBaseDirectory to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 Branding. Setting variable iBranding to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 Version. Setting variable brandingVer to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 Shortcuts. Setting variable iShortcut to empty value
[17:52:01] Using branding: PostgreSQL 14
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 SB_Version. Setting variable sb_version to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 pgAdmin_Version. Setting variable pgadmin_version to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 CLT_Version. Setting variable clt_version to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 Data Directory. Setting variable server_data_dir to empty value
Executing C:\Users\junkwong\AppData\Local\Temp/postgresql_installer_c7c2d91f40/temp_check_comspec.bat
Script exit code: 0
Script output:
Script stderr:
Exiting with code 1
And the COMSPEC variable is indeed set as a System Variable not a User Variable like many posts proposed. Also, there is no trailing semi colon (;)
What I have tried:
I have ran the "%COMSPEC%" /C "echo test ok" on my command prompt and got "test ok" as result see here
Ran the installation on Administrator cmd.
To install different versions of PostgreSQL including 14.2.2, 14.3.1 and 13.7.1 (all produce the same error message)
Tried out the solution proposed by Prayash Koirala but no Command Processor file can be found Postgresql 9.4 installation/Windows 8.1/ COMSPEC issue
Tried this Problems Installing PostgreSQL 9.2 . but the bitrock_installer_xxxx.log is absent from the suggested path
Thank you very much, any help or suggestions are appreciated.
Have a good day.
Regards,Jun Kang
Run the following command at a command prompt:
fsutil behavior set disable8dot3 1
Restart the computer.
This is a solution from https://learn.microsoft.com/en-GB/troubleshoot/windows-server/performance/stop-error-code-0x00000019, it worked for me.
I had the same issue and search all over. Have tried a lot but finally
I found a working solution. Seems like the problem is related to handling
of 8.3 filenames. I followed the tip in: https://hub.alfresco.com/t5/alfresco-content-services-forum/solved-installation-error-on-windows-10-x64-registerservice-bat/td-p/209616
or go directly to
https://support.microsoft.com/en-gb/help/121007/how-to-disable-8.3-file-name-creation-on-ntfs-partitions
Compared to the guide my default registry key was 2 and not 0. Anyhow,
changing it to 1 (+reboot) allowed the COMSPEC-test to pass.
Seems to be a "installation script" vs "Win10" issue...
/Björn
Hi i have faced the same issue but then i changed the environment variables of CompSpec to name: ComSpec and the path: C:\Windows\system32\cmd.exe and restarted my pc and it installed successfully. Hope it helps.
I faced this problem once again, and my previous answer didn't work for me this time.
I solved the problem by instead of using classic PostgreSQL installer, I set this up with a Docker.
Install Docker Desktop
https://www.docker.com/products/docker-desktop/
Start installed Docker Desktop
In PowerShell, run:
docker pull postgres
In PowerShell, run:
docker run -d -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=mypassword postgres
Now you can connect to the Postgres server for example with pgAdmin on the same machine, using:
host: localhost
port: 5432
maintenance database: postgres
username: postgres
password: mypassword
I had the same error like yesterday man and the answer above is pretty correct. I am just going to elaborate the procedure in clearor steps.
First, right-click on the Windows icon on your taskbar and select System.
In the Settings window, under Related Settings, click Advanced system settings.
On the Advanced tab, click Environment Variables.
Under System Variables click New to create a new environment variable. Name it ComSpec and set the path to point to C:\Windows\system32\cmd.exe
After creating the environment variable click Apply and then OK to have the change take effect.
Restart might be required.
Peace.

Ran a SQL*Plus query directly against Pluggable Database

we are starting to work with oracle multitenant architecture, and modify our custom shell commands accordingly. so in the aspect of running an SQLPlus query against the CDB, nothing has really much changed, we are still declaring the Oracle_HOME and Oracle_SID environment variables, and concatenating the actual query and the user and password credentials, like this:
export ORACLE_SID=contdev;export ORACLE_HOME=/oracle/app/oracle/product/19.3;printf "SHOW CON_NAME;"| $ORACLE_HOME/bin/sqlplus -s 'c##devuser/devpassword'
but we are struggling to achieve the same for the PDB, as we don't use tnsnames, we still required to connect with user name and password, with a one liner shell command, not a script. due to our security team policy.
searching on web, we have found that another environment variable is available for the PDB, named: ORACLE_PDB_SID. but when we trying to ran the following command:
export ORACLE_SID=contdev;ORACLE_PDB_SID=contDev1;export ORACLE_HOME=/oracle/app/oracle/product/19.3;printf "SHOW CON_NAME;"| $ORACLE_HOME/bin/sqlplus -s 'c##devuser/devpassword'
We are still getting the output from the root container, and not the PDB:
CON_NAME
------------------------------
CDB$ROOT
Another search on the web, we found that we need use ALTER SESSION SET CONTAINER=contDev1; but it's not clear how to use this, in the above command.
After connecting to the Oracle database, just type show pdbs:
SQL> show pdbs
SQL> alter session set container=<DB_NAME>_PDB;
SQL> show pdbs

dbstart won't accept $ORACLE_HOME

I'm trying to start some oracle databases on RHEL, however when I run the dbstart command, I get an error message saying ORACLE_HOME_LISTNER isn't set.
[oracle#olxxxa ~]$ dbstart $ORACLE_HOME
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /u01/app/oracle/product/12.1.0/dbhome_1/bin/dbstart ORACLE_HOME
Processing Database instance "xxxa": log file /u01/app/oracle/product/12.1.0/dbhome_1/startup.log
Processing Database instance "xxxb": log file /u01/app/oracle/product/12.1.0/dbhome_1/startup.log
Looking online, I saw people were saying to change the dbstart file so that ORACLE_HOME_LISTNER is set from $1 to $ORACLE_HOME, which I did however I'm still getting the same error. I also read that I could pass $ORACLE_HOME right into the dbstart command, however I get the same output with or without the variable being passed.

Why is .pgpass file not supplying a password for the pg_dump, vacuumdb, or reindexdb commands?

I'm trying to execute several different PostgreSQL commands inside of different bash scripts. I thought I had the .pgpass file properly configured, but when I try to run pg_dump, vacuumdb, or reindexdb, I get errors about how a password isn't being supplied. For my bash script to execute properly, I need these commands to return an exit code of 0.
I'm running PostgreSQL 9.5.4 on macOS 10.12.6 (16G1408).
In an admin user account [neither root nor postgres], I have a .pgpass file in ~. The .pgpass file contains:
localhost:5432:*:postgres:DaVinci
The user is indeed postgres and the password is indeed DaVinci.
Permissions on the .pgpass file are 600.
In the pg_hba.conf file, I have:
# pg_hba.conf file has been edited by DaVinci Project Server. Hence, it is recommended to not edit this file manually.
# TYPE DATABASE USER ADDRESS METHOD
local all all md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
So, for example, from a user account [neither root nor postgres], I run:
/Library/PostgreSQL/9.5/pgAdmin3.app/Contents/SharedSupport/pg_dump --host localhost --username postgres testworkflow13 --blobs --file /Users/username/Desktop/testdestination1/testworkflow13_$(date "+%Y_%m_%d_%H_%M").backup --format=custom --verbose --no-password
And I get the following error:
pg_dump: [archiver (db)] connection to database "testworkflow13" failed: fe_sendauth: no password supplied
I get the same result if I run this with sudo as well.
Curiously, pg_dump does execute, and does export out a .backup file to the testdestination1 directory, but since it throws an error, if it's in a bash script, the script is halted.
Where am I going wrong? How can I make sure that the .pgpass file is being properly read so that the --no-password flag in the command works?
Please start with a read to official docs.
Also, even this topic is more than 2 years also, i strongly suggest to update to at least to version 10, anyhow nothing relevant has been changed around .pgpass
.pgpass need to be chmod 600, fine, the user that uses that must can read, so that must be the owner of that file.
Please remove the --no-password that just confuse and is not needed.
Using 127.0.0.1 instead of localhost clarify where you are going, "usually" are the same.
... from a user account [neither root nor postgres] ...
The user you are using for must have read access to .pgpass, as said, so you have to clarify that and provide that file to that user, maybe using the PGPASSFILE env variable could be useful for you.
Another way is the use of .pg_service.conf file with or without the .pgpass, for what you have written it looks like that may be more appropriate
Also you could set the PGPASSWORD in the env of the user.
Think about security, some choices look the simpliest but can expose accesses .. and as DBA I'm frankly tired about peoples that store password in visible places, printed in logs or on github or set "trust" in pg_hba and finally comes to me to say "postgreSQL is insecure".. hahaha!
Final note, you do not have a pg_hba error, in case you will have a "pg_hba" error message.
Turns out that changing all three lines in the pg_hba.conf file to the trust method of authentication solved this.
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
Since the method is trust, the .pgpass file may be entirely irrelevant--I'm not sure, but at least I got it working.

Passing variable user,pass,sid in sqlplus comman

I want to pass variables in sqlplus command in my bash script, answer might be given but doesn't work for me.
I tried some thing like this
#!/bin/bash
ssh oracle#10.116.12.26 <<XX
echo Please enter an Oracle Username:
read USERNAME
echo "Please enter the Oracle Username's Password:"
read -s PASS
SID=XE
export conn_str=$USERNAME/$PASS#$SID
sqlplus $conn_str << EOF
select * FROM tabs;
exit
EOF
XX
also tried
sqlplus $USERNAME/$PASS#SID #with option -s and -l
I also find solution like this
but not worked for me.
oracle : 11g
,os : fedora 18
Is there any solution available for this ?
thanks.
You haven't said what actually happens, but I'm guessing you aren't prompted for the credentials, and that maybe it can't find sqlplus. On a Red Hat box this works:
#!/bin/bash
echo Please enter an Oracle Username:
read USERNAME
echo "Please enter the Oracle Username's Password:"
read -s PASS
SID=XE
conn_str=$USERNAME/$PASS#$SID
ssh oracle#10.116.12.26 << EOF
# set these for your specific environment
ORACLE_HOME=<path to ORACLE_HOME>
PATH=$PATH:$ORACLE_HOME/bin # or without .../bin depending on client
TNS_ADMIN=<path to tnsnames.ora directory, if not default>
sqlplus -s /nolog
connect $conn_str
select * FROM user_tables;
exit
EOF
This is collecting the values from the user on the local machine to avoid the 'Pseudo-terminal will not be allocated because stdin is not a terminal' issue.
It is then setting up the Oracle environment once on the remote server - what you need to set depends on which client you're using (particularly whether you're using the instant client, though if you're connecting as oracle that seems unlikely, and you can probably run oraenv).
I've also tweaked it to run SQL*Plus with /nolog and then connect once running, so the credentials aren't exposed in the ps output. And I've switched from the old tabs to the more common user_tables.
The nested heredocs work but aren't necessary; the SQL commands are already being entered in the right place and will be seen by SQL*Plus rather than the remote shell.
Of course, since I don't know what error you were actually seeing this is largely speculation. It would probably be simpler to have the client installed locally and use a SQL*Net connection rather than SSH, but there could be firewall restrictions we don't know about.
Try quoting your here doc delimiter to prevent stale variable expansions on the local machine.
ssh oracle#10.116.12.26 <<'XX'

Resources