Tag Info

New answers tagged

2

From the documentation: createdb is a wrapper around the SQL command CREATE DATABASE. There is no effective difference between creating databases via this utility and via other methods for accessing the server. This means that you can write a script which issues a command like psql -f createdb.sql -v passwd=$passwd -v user=$user Where ...


1

In order to connect to your PostgreSQL instance and run the createdb script, which is a client, you can use a password file. This file is generally located at ~/.pgpass and must contain theses information : hostname:port:database:username:password If you want to use a different path for your password file, you can set the PGPASSFILE environment variable. ...


3

Using a batch file and SQLCMD, you can execute the script as below : cls echo off set DbServer=Server_name\InstanceName set MyLogin=sa set MyPassword=StrongPassword set MasterDbName=master set DbName=AdventureWorks set SQLCMDPath=C:\Program Files\Microsoft SQL Server\90\Tools\binn set SpScripFilePath=C:\ScriptFolder set SpScripFileName=test.sql echo ...


3

As you describe it, it's not going to work. The T-SQL script needs to run on a SQL Server which means that it needs to be run in an appropriately-authenticated session. One option would be to write the TSQL script, and then provide it with a VBScript or CMD file or PowerShell script that'll launch the TSQL at the correct server with the right credentials.


0

You can use pg_basebackup to take a copy of the PostgreSQL database over the replication protocol. It copies the whole DB though, it isn't incremental. You'll want to use the --xlog-method=stream argument unless you have a shared WAL archive set up. Streaming replication isn't really well suited to the purpose you describe. You can set it to have ...



Top 50 recent answers are included