1

I want to automate a MS-DOS command which requires a password, however the password can not be passed as one of the command line options. How can I do this?

The command I want to run is

dumpdata --schema=mydb mytable C:\temp\output.sql

[This command extracts data from an Oracle database in the form of Insert statements]

There is then a prompt for the password, which needs to be entered manually.

Removing the password (from the database) is not an option, as per Writing a batch file that enters a password when prompted

Thank you!

Community
  • 1
  • 1
gordon613
  • 2,770
  • 12
  • 52
  • 81

2 Answers2

2

If I understand it correctly you should set up an environment variable named ORA_USERID containing your username/password. If not set than you will be prompted for the password when connecting using the dumpdata command. Checkout OracleTools.

Cyclonecode
  • 29,115
  • 11
  • 72
  • 93
  • Thank you very much. In fact (after following the instructions on the link) I simply replaced --schema=mydb with --scheme=mydb/mypassword – gordon613 Mar 18 '12 at 15:47
  • Yes, I found that you could achive the same thing that way too. Nice you solved it though. – Cyclonecode Mar 18 '12 at 15:48
1

If dumpdata can read from a pipe, this may work:

echo PASSWORD | dumpdata --schema=mydb mytable C:\temp\output.sql
benesch
  • 5,239
  • 1
  • 22
  • 36