I'm following the tutorial of loading a dvdrental database as shown in the link below:
http://www.postgresqltutorial.com/load-postgresql-sample-database/
I have done the first step successfully but when I came to the step 2 and 3 which navigating the bin folder and loading the data I was stuck. It keeps prompt me with the invalid command message as shown in the picture below.
Anyone know how to solve this issue? Thanks in advance for all the help!
You should be running pg_restore from the shell, not from inside psql. pg_restore is a separate command line program, not a psql command.
Related
This is my first question. Please bear with me if I am not stating the question clearly.
When I try to restore a database using "dvdrental.tar" file, the following is the screenshot of the restore option.
Restore Option
Then the failed exit code: 3221225595 appears.
enter image description here
I was wondering whether anyone would help me with this issue. Thank you!
You seem to be using an old version of pgadmin4 which has a bug where it does not accurately convey the error message back to you. The big blank box between the Start Time and the Failed should contain a message.
The Postgresql file on my server doesn't seem to start. When I looked at the /var/lib/pgsql/pgstartup.log file, it gives the following errorFATAL: could not create shared memory segment: Invalid argument
I read a lot of other posts which suggested changing the SHMMAX value. I did this through the /etc/sysctl.conf file and then ran sysctl -p. It worked the first time and the PGSQL service started running. But then, when I tried a SQL import (of 55GB), it again stopped and this time changing the SHMMAX value didn't help. Actually, the problem started with importing the SQL file of 55GB. It worked till the first 30% and then stopped. I don't know why it keeps crashing.
Basically, there are two things I'm seeking help for:
How to get the PGSQL service running?
How to import a 55GB SQL file without any problems?
I've looked into a lot of resources, still haven't been able to find a solution. Any help will be appreciated.
Thanks!
EDIT: I found the solution. The issue was with disk space. After I emptied the psql data log files (day-wise), the service started working. Thank you all for the help.
This has been solved now. The edited post contains the solution too.
Thanks!
So I'm trying to setup this script that pipes this data via an API into BigQuery.
It's all being done on the command line, and I've already successfully setup the framework behind it. Specifically, setting up the schema.json file.
When I run the following, it successfully uploads:
bq load --source_format=NEWLINE_DELIMITED_JSON --max_bad_records=10 program_users gs://internal/program_user.json program_users_schema.json
As I said, this successfully pipes into BQ, which is great. But the problem is, this API only allows a max of 50 records at a time when there are over 1000.
EDIT: The initial call to retrieve the records looks like this:
$ curl -s https://api.programs.io/users/57f263fikgi33d8ea7ff4 -u 'dG9rOmU5NGFjYTkwXzliNDFfNGIyJ24iYzA0XzU0NDg3MjE5ZWJkZD=': -H 'Accept:application/json'
Would anyone have a solution to this, particularly, one that is done in the command line?
I am looking to write a script that will send an ssh command over. However, there will be sub commands after a command is entered. I was hoping to do this in a single line.
Example: ssh command
>showstuff
response:>what stuff would you like to show?(1,2,3,4):
>1
response:>would you like to show more info on that stuff?(y,n):
>y
response:>here you go
Is there something to do this in a single line? ie showstuff->1->y
Or is there another easy enough way to handle this?
I found a great library for connecting with SSH. Here's an example of what I used:
Chilkat Example
Link for the library is at the top of the example. I used the ChannelSendString then the ChannelReceiveUntilMatch to wait for the response. Then I sent another command via the ChannelSendString command. Worked like a charm!
I've used this library for a bunch of solutions now.
I'm running a process in a screen (on Ubuntu 13.10, if it matters). I can execute a command within that screen with:
screen -p 0 -X eval 'stuff \"$command\"\015'
I'm not 100% sure what this command is doing to begin with, though it's functioning correctly. The reason behind it is I'm running a Minecraft server (still) and this screens in to the correct screen, and throws the command on the running command line. So that's good, so far.
But what I'd like is to be able to run this command with a return value. So for example, if I were to run a "list" command, it'd tell me how many people and who is online, but I need to capture that output and put it somewhere.
Anyone know of a way to accomplish this? I can't tell the minecraft server command line to redirect the output somewhere else since it doesn't have direct command line access, so the only way I could do this would be to grab all output of the screen while I'm connected ... but I'm not sure if that's possible.
I think you may be able to view the logs? can you not view a running log of the server ?