Access is denied error when initializing PostgreSQL DB on Windows - windows

I'm on Windows 10. I downloaded the most recent version of Psql.
I was like:
C:\Program Files\PostgreSQL\9.6\bin>initdb.exe "C:\psql_db"
The files belonging to this database system will be owned by user "Sean".
This user must also own the server process.
The database cluster will be initialized with locale "English_United States.1252".
The default database encoding has accordingly been set to "WIN1252".
The default text search configuration will be set to "english".
Data page checksums are disabled.
creating directory C:/psql_db ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... windows
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
"pg_ctl" -D "C:\psql_db" -l logfile start
C:\Program Files\PostgreSQL\9.6\bin>"pg_ctl" -D "C:\psql_db" -l logfile start
And it was like:
server starting
Access is denied.

I think you are trying to create the logfile inside C:\Program Files\PostgreSQL\9.6\bin, for which you don't have write permission
Specify something like "pg_ctl" -D "C:\psql_db" -l "c:\users\joe\logfile" start

This is because of windows file permissions. You can put the data folder on desktop "c:\Users\\Desktop\" instead of "C:\psql_db". Or maybe give your user more permissions.

Related

There is no 'app\oracle\products\...' folder in C drive

I have downloaded Oracle SQL developer. When I try to create a new connection, it shows error as
Status : Failure -Test failed: IO Error: The Network Adapter could not establish the connection.
I tried default usernames and passwords such as SYS, SYSTEM and hr. But none of them worked. I tried setting all the environment variables properly. I tried to login through sqlplus. Nothing worked. Searched in system services, no services are present with name oracle or oracle services.
There is no folder named app in C drive to set ORACLE_PATH or ORACLE_HOME. There is no path such as c:\app\oracle\product.... I have searched for oracle\product\... folder in other directories also. But I could not find any such folders.
Am I missing anything?

How to change user permissions on a folder so postgres can acces it?

I want to export some data of my PostgreSQL Database with the COPY command.
The manual states: "COPY with a file name instructs the PostgreSQL server to directly read from or write to a file. The file must be accessible by the PostgreSQL user (the user ID the server runs as) and the name must be specified from the viewpoint of the server."
How can I make sure that the requirements are fullfilled, or otherwise enable them?
Im using Postgres 10 on a Windows 7 Notebook.
Login as PostgreSQL operating system user and try to read the file.
Alternatively, try COPY and see if you get an error message.

initdb for postgresql on os x fails

Having trouble installing postgres 10 on my Mac, version 10.12.5.
I've tried installing 2 ways:
(1) Downloading Postgres.app
(2) `brew install postgresql`
and tried to manually run a bunch of variations of these commands for initdb:
$ initdb /Applications/Postgres.app/Contents/Versions/latest/bin/ver-10
$ initdb /usr/local/var/postgres -E utf8
All yield the same error FATAL: could not create semaphores: Invalid argument.
Full trace:
The files belonging to this database system will be owned by user "foo".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /usr/local/var/postgres ... ok
creating subdirectories ... ok
selecting default max_connections ... 10
selecting default shared_buffers ... 400kB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... 2018-03-12 20:49:58.654 PDT [98144] FATAL: could not create semaphores: Invalid argument
2018-03-12 20:49:58.654 PDT [98144] DETAIL: Failed system call was semget(1, 17, 03600).
child process exited with exit code 1
initdb: removing contents of data directory "/usr/local/var/postgres"
I'm not sure what FATAL: could not create semaphores: Invalid argument means. I've seen a lot of other answers related to insufficient space, but not this one.
Thanks in advance!
I had to remove Postgres which I install via Brew, and then I reinstalled Postgres.app, and then restarted my computer, and then opening the app and clicking 'initialize' fixed it.

Has anyone tried oracle export : EXPDP on the remote machine?

I am trying to export a dump file and log file on a remote machine using oracle expdp.
However i am getting the following error :
Connected to: Oracle Database 11g
Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing
options
ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-29283: invalid file operation
Command run on remote machine host-name 'Local' using oracle client are :
SQL> create directory expdp_dir as '/vault2/expdp_dir';
SQL> grant read,write on directory expdp_dir to dbuser;
expdp dbuser/dbpwd#SID SCHEMAS=dbuser DIRECTORY=expdp_dir DUMPFILE=testDB24NOV17.dmp logfile=testDB24NOV17.log EXCLUDE=STATISTICS
Note vault 2 is mounted on a remote machine with hostname 'Local'. The database is on a machine with hostname TestDB.
The OS is RHEL6.
Any thoughts /ideas on making this operation successful would be appreciated.
Please check this one:
as per Oracle Doc.ID Doc ID 1305166.1
The errors can have multiple causes. Known causes are listed below.
One of the usual reasons for this problem to occur is when the listener process has not been started under the same account as the database instance service. The listener forks the new server process and when this runs under a different security context as the database, then access to directories and files are likely impacted.
Please verify the following information:
1) the output of:
ps -ef | grep SMON
2) the output of:
ps -ef | grep tnslsnr
3) the output of:
ps -ef|grep LIST
4) the output of:
ls -ld
Note:
When using ASM, the listener may have been started from the ASM Home instead of the RDBMS Home. Depending on your security settings, this may give to this issue.
One more:
4. Directory path/folder exists but create directory is executed by a different user in the database and the import is run by a different user.
Solution:
1. Make sure the listener and instance services are started from the same account.
Make sure that the directory are shared between nodes so that the directory can be accessed on any instance, or, create a folder similar to the other nodes locally, if there is already a folder created locally on the all the node with the same file directory path structure check if the permission are correct.
Make sure the folder exist has specified in during creation in the "CREATE DIRECTORY" syntax command.
Grant the required permission to the importing user to use the directory.
grant read, write on directory to ;
If above 4 possible causes and solutions are not applicable at your end, please check if the user has proper permission to export to run utl_file package.
Hope it helps.

how to create new database in H2?

I have a site running locally on MySQL i want to run it on H2 database. I have just run h2.jar file for console on the browser but whenever I Log in I have seen the list jdbc:h2:/var/www/mysite/data/db; MODE=MySQL, information_schema and users.I can create tables in it but don't know how to create new database?
I am using Mode = MySQL
type = H2 Database Engine in Embedded mode.
From http://www.h2database.com/html/tutorial.html#creating_new_databases,
By default, if the database specified in the URL does not yet exist, a
new (empty) database is created automatically. The user that created
the database automatically becomes the administrator of this database.
The settings of the H2 Console are stored in a configuration file called .h2.server.properties in your user home directory. For Windows installations, the user home directory is usually C:\Documents and Settings\[username] or C:\Users\[username]. The configuration file contains the settings of the application and picked up when the H2 Console is started.
Below config to create a new database on startup:
add newline in property file.
0=Generic H2 (Server)|org.h2.Driver|jdbc\:h2\:tcp\://localhost/~/db_name|sa
open the command prompt go to the \bin directory where h2 has installed:
e.g. cd C:\Program Files (x86)\H2\bin
and run following the command
java -cp h2-1.4.194.jar org.h2.tools.Server.
Other General Settings:
webAllowOthers: allow other computers to connect.
webPort: the port of the H2 Console
webSSL: use encrypted TLS (HTTPS) connections.

Resources