I am trying to run Netezza's command line tool nzload from my Windows laptop to load a csv (comma separated value) file to a Netezza database.
I installed the Netezza client tools and have the executable (nzload.exe).
I tried the following:
nzload -h server.domain.com -u username -pw password -db DEVDB -t DRIVERS -delim ',' -df C:\Users\me\Desktop\Data\Test.csv
nzload -h server.domain.com -u username -pw password -db DEVDB -t DRIVERS -delim "," -df "C:\Users\me\Desktop\Data\Test.csv"
Nothing seems to work.
Any help appreciated.
You might want to consider aginity for loads from ms windows. It has an import wizard and the like.
http://www.aginity.com/workbench/netezza/
should be a free download.
You are attempting to use the help flag (-h) to set the target hostname. Try using the -host flag instead.
D:>"c:\Program Files (x86)\IBM Netezza Tools\Bin\nzload" -db testdb
-host 192.168.118.139 -u user -pw password -db testdb -t load_table -delim "," -df "d:\test.csv"
Load session of table 'LOAD_TABLE' completed successfully
Related
On Postgresql, I needed to copy databases from a server to another. I see the solutions use commands like:
pg_dump -C -h remotehost -U remoteuser dbname | psql -h localhost -U localuser dbname
But.. where do I need to type these commands?
I would do that not in a single step ... I like it to have more control about such kind of processes.
You need to open a terminal window and then type the commands.
pg_dump -C --column_inserts -U remoteuser -h remotehost > my_backup.sql
# copy the file to the server you want
# change the desired parameter like the database name
nano my_baskup.sql
createdb -U newuser -h localhost newdb_name
psql -U newuser -h localhost postgres < my_backup.sql
If the copy to other databases in postgresql is sometimes tricky imo this is the most robust way
I want to restore a plain postgres backup, im doing it via psql.exe using this commands:
cd "C:\Program Files (x86)\PostgreSQL\9.0\bin\" <br>
psql -h 192.168.10.160 -p 5432 db_name postgres
then cmd displays db_name=# ,and I type, \i 'C:/Backup.sql' and the restore is done
Is there a way to do it using a batch file?
Yes, use the -f option to read from a file:
psql -h 192.168.10.160 -p 5432 -f C:\Backup.sql db_name postgres
When I do this I set the pgdump to include the database name in the sql before all the create tables
\connect mydatabasename
I have a database file on my desktop that I am trying to open through my terminal.
my database is called: myDB.db
I tried using:
mysql -u myDB.db -p
Thank you!!!
SOLVED for mysql! (Thank you Duffymo)
mysql -h localhost -u -p
>use [databaseName];
Also for sqlite you can do it this way:
sqlite3 [databaseName]
>.tables
I use the command line this way:
http://dev.mysql.com/doc/refman/5.6/en/mysql.html
mysql -h localhost -u <admin user name> -p
I'm prompted for the admin or user password.
When I get into MySQL I specify which database I want to work with:
use X;
where X is the name of the schema I'm interested in.
At that point I can execute SQL commands.
I have a stored procedure through which I am creating a dynamic .sql file on the server and the file have successfully generated. Now I want o execute the same file through query in the same stored procedure .
I have go through the links and found the below lines useful
osql -D db_name -S server_name -U username -P password -i sqlfile
or
sqlcmd -D db_name -S server_name -U username -P password -i sqlfile
I have tried to implement the above but it is giving me the error of
osql is not a recognized option
Please tell me the correct way. Thanks
sqlcmd is a command line tool and cannot be called directly from inside a stored procedure.
Use xp_cmdshell to execute it:
EXEC master.dbo.xp_cmdshell ‘sqlcmd -D db_name -S server_name -U username -P password -i sqlfile’
I have a problem restoring a PostgreSQL DB which I have backup early using the following command:
pg_dump -i -h localhost -p 5432 -U Mark -F c -b -v -f "C:\Users\mchan\Desktop\MyDB\DBBackup.backup" mydb
Now When I try to restore this DB backup on (another machine) I got the following error:
pg_restore: [archiver] directory "C:\Users\mark\Desktop\MCHANBackups\DBBackup.backup" does not appear to be a valid archive ("toc.dat" does not exist)
Below is the command I used to restore the backup:
pg_restore -i -h localhost -p 5432 -U Mark -d mydb -v "C:\Users\mark\Desktop\MCHANBackups\DBBackup.backup"
Can someone please help me and tell me what I am doing wrong here?
I think you have used custom format and the backup is sent to normal text file. For restoring from text files, use
psql command: psql -e -d template1 -f "C:\Users\mchan\Desktop\MyDB\DBBackup.backup" Refer to this post on Postgresql's Community page.
Use the psql command as follows:
psql -e -U username -d databaseName -f "C:\Users\mchan\Desktop\MyDB\DBBackup.backup"
Username should be a role defined in the database. Ex: postgres
If the psql command prompts for a password and you don't know the password for the user, replace "md5" with "trust" in pg_hba.conf file under "/data" folder and restart "postgres service" for this change to take effect.
Once this change is done psql will not prompt for the password.
For more documentation on psql and additional options , refer to psql-doc.