0

I'd like to be able to automatically save the DDL scripts from my development schema on a regular basis.

Cade Roux
  • 88,164
  • 40
  • 182
  • 265

2 Answers2

1

You can use the datapump to generate DDL statements.

expdp schemaname/password reuse_dumpfiles=y include=directory full=y content='METADATA_ONLY' directory=data_pump_dir dumpfile=ddl_scripts.dmp

Sathyajith Bhat
  • 21,321
  • 22
  • 95
  • 134
-1

DDL is code, you should use source control to archive any code.

See also those questions (among others) on SO for some example:

Community
  • 1
  • 1
Vincent Malgrat
  • 66,725
  • 9
  • 119
  • 171
  • 1
    I think Cade is asking about how to export the DDL in the first place rather than how to secure it afterwards. – Eight-Bit Guru Nov 19 '10 at 16:00
  • @Jonners: there are many tools that would provide the initial export -- Oracle SQL Developer for example is free and comes with this feature. Afterwards I stand by my answer: you don't need to export *on a regular basis* your DDL scripts because you already have them in your source control repository. – Vincent Malgrat Nov 19 '10 at 16:06
  • This isn't a question about source control. While I agree that all changes to a database and all object creation scripts should be in source control, this question is not about that. I have a schema which gets changed through a variety of methods and I need to take snapshots of it as scripts so I can look at them without taking full backups. – Cade Roux Nov 19 '10 at 19:48
  • 1
    @Cade Roux: In that case I would use `exp` with `rows=N`. This will export all DDL without data (and can be used in scripts). – Vincent Malgrat Nov 19 '10 at 20:33
  • exp works better for this than expdp, since I don't have easy access to the server – Cade Roux Nov 22 '10 at 19:16