Issue with Postgres on windows 10 - sql

I have installed PostgreSQL 13 on windows 10
When I tried to run this command:
$ which Postgres on Git Bash, It returns which: no Postgres in (/c/Users*ahmedeid/......
Could you help me solve the issue?

It seems that your PostgreSQL installation's bin directory is not on the PATH, so you cannot find the server executable.
You'll have to modify the PATH environment variable appropriately.
Another possibility is that your bash was already running when you installed PostgreSQL, so that its PATH setting is out of date. Try closing bash and start a new one. Maybe that one has the correct setting.

Related

Change jdk path for the integrated weblogic server in oracle soa suite

I keep getting this error after launching an integrated Weblogic server in Jdeveloper,
Starting WLS with line:
C:\PROGRA~1\Java\JDK18~1.0_2\bin\java -server -Xms768m -Xmx1536m -XX:PermSize=256m -XX:MaxPermSize=1024m -Dweblogic.Name=DefaultServer -Djava.security.policy=C:\Oracle\MIDDLE~1\ORACLE~1\wlserver\server\lib\weblogic.policy
-Djavax.net.ssl.trustStore=C:\Users\Idiot\AppData\Local\Temp\trustStore7893387873075798475.jks -Doracle.jdeveloper.adrs=true -Dweblogic.nodemanager.ServiceEnabled=true
-Xverify:none -Djava.endorsed.dirs=C:\PROGRA~1\Java\JDK18~1.0_2\jre\lib\endorsed;C:\Oracle\MIDDLE~1\ORACLE~1\oracle_common\modules\endorsed -Djava.protocol.handler.pkgs="oracle.mds.net.protocol|oracle.fabric.common.classloaderurl.handler|oracle.fabric.common.uddiurl.handler|oracle.bpm.io.fs.protocol" -Dopss.version=12.1.3
-Digf.arisidbeans.carmlloc=C:\Users\Idiot\AppData\Roaming\JDEVEL~1\SYSTEM~1.100\DEFAUL~1\config\fmwconfig\carml -Digf.arisidstack.home=C:\Users\Idiot\AppData\Roaming\JDEVEL~1\SYSTEM~1.100\DEFAUL~1\config\fmwconfig\arisidprovider
-Doracle.security.jps.config=C:\Users\Idiot\AppData\Roaming\JDEVEL~1\SYSTEM~1.100\DEFAUL~1\config\fmwconfig\jps-config.xml -Doracle.deployed.app.dir=C:\Users\Idiot\AppData\Roaming\JDEVEL~1\SYSTEM~1.100\DEFAUL~1\servers\DefaultServer\tmp\_WL_user -Doracle.deployed.app.ext=\- -Dweblogic.alternateTypesDirectory=C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\oracle.ossoiap_12.1.3,C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\oracle.oamprovider_12.1.3,C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\oracle.jps_12.1.3 -Dweblogic.jdbc.remoteEnabled=false -Dcommon.components.home=C:\Oracle\Middleware\Oracle_Home\oracle_common -Djrf.version=12.1.3
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger -Ddomain.home=C:\Users\Idiot\AppData\Roaming\JDEVEL~1\SYSTEM~1.100\DEFAUL~1 -Doracle.server.config.dir=C:\Users\Idiot\AppData\Roaming\JDEVEL~1\SYSTEM~1.100\DEFAUL~1\config\fmwconfig\servers\DefaultServer -Doracle.domain.config.dir=C:\Users\Idiot\AppData\Roaming\JDEVEL~1\SYSTEM~1.100\DEFAUL~1\config\fmwconfig -Doracle.mds.filestore.preferred=true -Dadf.version=12.1.3 -Doracle.osb.home=C:\Oracle\Middleware\Oracle_Home\osb -da
-Dwls.home=C:\Oracle\MIDDLE~1\ORACLE~1\wlserver\server -Dweblogic.home=C:\Oracle\MIDDLE~1\ORACLE~1\wlserver\server -Djps.app.credential.overwrite.allowed=true -Djavax.management.builder.initial=weblogic.management.jmx.mbeanserver.WLSMBeanServerBuilder -da:org.apache.xmlbeans... -Dem.oracle.home=C:\Oracle\Middleware\Oracle_Home\em -DINSTANCE_HOME=C:\Users\Idiot\AppData\Roaming\JDeveloper\system12.1.3.0.41.140521.1008\DefaultDomain -Djava.awt.headless=true -Doracle.sysman.util.logging.mode=dual_mode -Dsoa.archives.dir=C:\Oracle\Middleware\Oracle_Home\soa\soa -Dsoa.oracle.home=C:\Oracle\Middleware\Oracle_Home\soa -Dsoa.instance.home=C:\Users\Idiot\AppData\Roaming\JDEVEL~1\SYSTEM~1.100\DEFAUL~1
-Dtangosol.coherence.log=jdk -Djavax.xml.soap.MessageFactory=oracle.j2ee.ws.saaj.soap.MessageFactoryImpl -Dweblogic.transaction.blocking.commit=true -Dweblogic.transaction.blocking.rollback=true -Djavax.net.ssl.trustStore=C:\Oracle\MIDDLE~1\ORACLE~1\wlserver\server\lib\DemoTrust.jks -Doracle.xml.schema\Ignore_Duplicate_Components=true -Doracle.xdkjava.compatibility.version=11.1.1 -Doracle.soa.compatibility.version=11.1.1 -Dums.oracle.home=C:\Oracle\Middleware\Oracle_Home\oracle_common -Djava.util.logging.manager=oracle.core.ojdl.logging.ODLLogManager weblogic.Server
Stopping Derby server...
The system cannot find the path specified.
Derby server stopped.
I uninstalled the latest JDK8 and have only the 7th version in my computer. I checked my environment variables and all possible configuration files like jdev.conf and setENVvar.cmd
Has anyone faced the same issue?
Weblogic annoyingly hard codes the value of JAVA_HOME in ORACLE_HOME\wlserver\common\bin\commEnv.cmd around line 103. The shell version of the script does at least give the option to override this as long as both JAVE_HOME and JAVA_VENDOR are set, but there's no such feature in the Windows script I'm afraid - you just have to edit the file.
The Oracle installer puts the JDK path into several configuration files. You can find them by running e.g. this command within your Oracle_Home directory:
find . -type f -exec grep -H 'jdk1.8.0_31' '{}' \;
In my case the list was:
./inventory/Components/oracle.fmwconfig.common.wls/12.2.1.0.0/context.xml
./inventory/Components/oracle.nginst.core/13.3.0.0.0/context.xml
./inventory/Components/oracle.wls.core.app.server/12.2.1.0.0/context.xml
./inventory/Components/oracle.wls.core.app.server/12.2.1.0.0/installIP2Log.xml
./jdeveloper/jdev/bin/jdev.conf
./oep/common/lib/metaInstallUnix.properties
./oep/common/lib/metaInstallWindows.properties
./oep/utils/load-generator/runloadgen.cmd
./oep/utils/load-generator/runloadgen.sh
./OPatch/bin/listDomainPatchInventory.cmd
./OPatch/bin/listDomainPatchInventory.sh
./oracle_common/common/bin/commBaseEnv.cmd
./oracle_common/common/bin/commBaseEnv.sh
./oracle_common/common/bin/setHomeDirs.cmd
./oracle_common/common/bin/setHomeDirs.sh
./oui/bin/compareInventory.cmd
./oui/bin/compareInventory.sh
./oui/bin/internal/ilaunch.cmd
./oui/bin/launch.sh
./oui/bin/viewInventory.cmd
./oui/bin/viewInventory.sh
./oui/mw/common/framework/bin/configinternal.cmd
./oui/mw/common/framework/bin/configinternal.cmd
./oui/mw/common/framework/bin/configinternal.sh
After replacing the version, all works fine again.
In Jdev 12.1.3, the location to change is system12.1.3.??? folder /DefaultDomain/bin/setDomainEnv.cmd (or sh).
You will find the JDK path there in 3 places. Change all of them to be safe.
However, if you are running ADF on your Integrated server, you will need to resolve issues where older jars may not support Java 8. This includes the older mysql driver that Oracle wants to deploy by default.

SQLDeveloper not starting

When i try to start SQLDeveloper, it is giving me the following error in command prompt:
Error: This product requires a Java(TM) Platform 5.0 runtime.
You are using 1.4.2-b28 from C:\j2sdk1.4.2\jre
But my JAVA_HOME is set to java 6
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_32
Can anyone explain what exactly to do to resolve this?
Oracle SQL Developer uses a configuration file named products.conf which is situated at your roaming directory.
If you are using Windows 7 then the directory path will be:
C:\Users\\AppData\Roaming\sqldeveloper\1.0.0.0.0
Delete whole sqldeveloper directory from C:\Users\\AppData\Roaming\
Re run sqldeveloper executable, this will prompt for jdk home
Select jdk home. i.e C:\Program Files\Java\jdk1.7.0_55
Enjoy!
In my case i had 2 folders under C:\Users\username\AppData\Roaming\
sqldeveloper
SQL developer
after removing both of them and launching installation dir\sqldeveloper\sqldeveloper\bin\sqldeveloper64.exe it worked.
True acknowledgement / attribution belongs to Vishal at the following URL:
http://vishalorcl.blogspot.com/2012/12/sql-developer-from-11201-client-software.html. It describes in detail how to resolve this problem. From the page:
I am running Oracle 11g version of SQLDeveloper. I have same problem
noted above, after fresh install of Oracle. The summary is that
SQLDeveloper seems to require the Java 32-bit JDK.
Install 32-bit jdk V7 from Oracle:
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
There is a sqldeveloper.conf file located in
C:\app\UserName\product\11.2.0\dbhome_1\sqldeveloper\sqldeveloper\bin
In the file change pathname within the line at end of file:
SetJavaHome C:\app\admin\product\11.2.0\client_1\jdk
To point to pathname of the jdk install directory; also sometimes
known as JAVA_HOME.
I had this problem too!
you should go to: C:\Users-your user name-\AppData\Roaming\sqldeveloper-version of your sql developer-
there is a file named product.conf there. Right click on it and edit it with notepad in the document change the address of java home and save it.
Done!
In my case, none of the other suggestions worked. Instead, I moved the installation directory from
c:\sqldeveloper
to
anything else
And things worked again. Perhaps, some Windows registry value got broken in an unfixable way...
I don't think SQLDeveloper uses the environment variable. There should be a .conf file that contains a reference to the JDK directory.
I solved this by deleting the folder /home/USERNAME/.sqldeveloper
After that, I started SQLDeveloper and without typing anything, it found the right java-version and started without complaining :-)
So, if you don't want to delete the whole folder, maybe search there for the file which defines the java-version :-)
edit: just found that:
"Type the full pathname of a J2SE installation (or Ctrl-C to quit), the path
will be stored in ~/.sqldeveloper/jdk"
check the version of java that you are installing to you Pc the error show that you are using 4 so uninstall the java that you have then install a new one that is version higher than 5
Removing the instances from the registry worked for me.

Is there a better way than this to run an SQL script through puppet?

Take a look at Get puppet build to fail when the contained SQL script fails execution
I was attempting to run a vagrant build which installs Oracle XE in an Ubuntu Virtualbox VM and then runs a an SQL script to initialize the Oracle Schema. The vagrant build is here : https://github.com/ajorpheus/vagrant-ubuntu-oracle-xe. The setup.sql is run as a part of the oracle module's init.pp (right at the bottom or search for 'oracle-script').
When running the SQL script as a part of the vagrant build, I see the following error:
notice: /Stage[main]/Oracle::Xe/Exec[oracle-script]/returns: Error 6 initializing SQL*Plus
notice: /Stage[main]/Oracle::Xe/Exec[oracle-script]/returns: SP2-0667: Message file sp1<lang>.msb not found
notice: /Stage[main]/Oracle::Xe/Exec[oracle-script]/returns: SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
There were two things that were instrumental in me finding a workaround for the problem:
As suggested in this answer, setting the logoutput attribute to true for the exec block under question immediately showed me the error, whereas before the exec was just failing silently.
It seemed strange that I was able to run the command (sqlplus system/manager#xe < /tmp/setup.sql) after manually logging in as the 'vagrant' user. That suggested that there was something missing in the environment. Therefore, I copied all ORACLE env. vars into the exec as seen on Line 211 here
That worked, however, setting up the env vars manually seems a bit brittle. Is there a better way to setup the ORACLE environment for the vagrant user? Or, is there a way to get puppet to setup the environment for the vagrant user similar to an interactive shell?
If some profile has been set up to give the user a working interactive shell, you should be able to pass your action through such a shell
command => 'bash -i -c "<actual command>"'
As an aside about logoutput, since you mentioned that - the documentation advises that "on_failure" is a sane default, as it will only bloat your output when there are actual errors to analyze. It is the actual default in the latests versions of Puppet.

The local psql command could not be located

I'm following the instructions found here.
When I try to run $ heroku pg:psql or $ heroku pg:psql HEROKU POSTGRESQL_BROWN I recieve the following error message:
! The local psql command could not be located ! For help
installing psql, see local-postgresql
I can't find anything useful on the link it gives me (it just links to the instructions I was already using, but further down the page) nor can I find this error anywhere else.
If I've missed anything you need to know to answer this, just let me know. I'm rather new to all this and teaching myself as I go.
I had same error even after installing Postgres locally.
But after seeing this
I saw that "pqsl" was not in the PATH so I then did
PATH=%PATH%;C:\Program Files\PostgreSQL\9.2\bin
which worked for me
I have since solved this myself. When I ran heroku pg:info it says the version number is 9.1.8, I was locally running 9.2
installing 9.1.8 and ensuring Path pointed to the appropriate folder solved the problem.
After you change the path, make sure to restart the terminal!
Set the PATH. To find out the PATH of your psql script (on mac) open the sql shell script from your finder in Applications/Postgres installation. This will give you a hint as to where it is installed. That opened a window which told me it is located here: /Library/PostgreSQL/8.4/scripts/runpsql.sh
Then, I set the PATH variable from the terminal window by typing:
$ PATH="/Library/PostgreSQL/8.4/bin:$PATH"
(depends on the location of your PostgreSQL installation, find your bin path first, another exp: /usr/local/Cellar/postgresql#9.6/9.6.8/bin)
OR.....
You can also connect to the shell by opening the shell directly from your postgres installation folder. Then enter the credentials. If you don't know the credentials, here is how to find them out:
$ heroku pg:info
=== HEROKU_POSTGRESQL_RED_URL (DATABASE_URL)
$ heroku pg:credentials HEROKU_POSTGRESQL_RED_URL
Top answer wouldn't work for me oddly, my system would not add the Path via cmd with administrator access (Not sure why).
So check this > Windows key > environment variables > system variables
And add the last line (your version may differ in the path)
Make sure you've installed the toolbelt as psql is installed by default.
However you also need to ensure you've installed a local copy of PostgreSQL; if you don't the toolbelt will be unable to find the native psql client.
Assuming you have installed a local copy of PostgreSQL, make sure you can execute psql from the command line directly (i.e make sure you PATH is set correctly ). If the command does not execute, check your PATH, if it does execute see if you can connect via the PSQL connection string provided in the Heroku control panel. If you can connect reinstall the toolbelt, if you are unable to connect provision another dev database and try again.
If there are still issues, I would suggest contacting Heroku support for assistance after verifying no API issues are listed on the status page located here.
I got rid if this annoying message on Windows by adding a path element without the spaces, i.e.
C:\Progra~1\PostgreSQL\9.4\data
instead of
“C:\Program Files\PostgreSQL\9.4\data”
I followed the instructions here: http://www.computerhope.com/issues/ch000549.htm, which worked for me if you prefer to go the point-and-click configuration of the PATH variable.
This type of error usually appears in the Windows environment, because if you do not update the PATH after installing Postgresql, heroku pg:psql command does not work.
So you need to update your PATH environment variable to add the bin directory of your Postgres installation. The directory will look like this:
C:\Program Files\PostgreSQL\<VERSION>\bin.
For more information, go to the Heroku in Local setup website:
heroku-postgresql: Local setup
I had the same problem and discovered that Heroku doesn't seem to provision the latest version of PostgreSQL by default. Where the Heroku Getting Started instructions said
heroku addons:create heroku-postgresql:hobby-dev
That provisioned a v10 database for some reason (which you can check by clicking on Heroku Postgres in the Add-ons tab of your dashboard). I deleted that database and provisioned a new database using the --version flag:
heroku addons:create heroku-postgresql:hobby-dev --version 11
As of now, at least, you can find the latest version of Postgres supported by Heroku at this link: https://devcenter.heroku.com/articles/heroku-postgresql#version-support-and-legacy-infrastructure
I'm writing this in early 2019, but according to the PostgreSQL website the next version (12) is "tentatively scheduled" for third quarter of 2019 so if you're reading this in late 2019 potentially the same problem will come up for v12 instead
On Mac you can use the following:
export PATH="/Library/PostgreSQL/12/bin/:$PATH"
The only solution that I found on Windows:
go to advanced system settings
go to environment variables
select Path variable and click Edit
add a new line and enter your bin directory path (C:\Program Files\PostgreSQL<version>\bin) and click ok
restart your terminal
enter your psql command (heroku pg:psql)

Postgresql changing data directory in ubuntu [duplicate]

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
Postgresql failed to start
This problem has been driving me crazy and nothing seems to be working. I need to change the location where postgresql stores the data base. I am a complete novice when it comes to using commands in the terminal and step by step instructions with the proper commands would really help. I searched all over the web but all instructions assume some prior good knowledge to terminal commands. I did try one approach by creating a symbolic link in the main data folder to my required location. This gives me an error that asks me to check the log file. However, I have no idea where the log file is. A lot of people seem to have this problem and a step by step solution would surely help. My Psql version is 8.4. Ubuntu 10.10
The latest log file full path is /var/log/postgresql/postgresql-8.4-main.log but the symbolic link is not the more integrated/easy way to change the data location.
I'd suggest to do it by creating the entire cluster to the desired location, with the pg_createcluster command that comes with the debian/ubuntu postgres packages.
1- delete your current cluster, if it does not contain any prior data:
$ sudo pg_dropcluster --stop 8.4 main
2- create a new cluster at the new location
$ sudo pg_createcluster -d /path/to/new/location 8.4 main
3- restart postgresql
$ sudo /etc/init.d/postgresql start