Coder Social home page Coder Social logo

usrecnik / ddlfs Goto Github PK

View Code? Open in Web Editor NEW
32.0 7.0 3.0 938 KB

Filesystem which represents Oracle Database objects as their DDL stored in .sql files

License: MIT License

Makefile 0.66% C 68.37% Shell 7.63% PLSQL 1.16% Java 0.08% Python 22.01% PLpgSQL 0.09%
filesystem sql-files ddl-scripts oracle

ddlfs's People

Contributors

usrecnik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ddlfs's Issues

4 kB read block

Hello Urh,

I'm testing 2.0-RC3 rpm and wondering why in filesize=-1 mode you are reading data
using 4 kB blocks ? I have slow database connection over WAN and wondering if there is any OCI/fuse/ddlfs limit which forced 4 kB reads ?

regards,
Marcin

execution bit

add execution bit (chmod u+x) for VALID objects. This way, most shells will display INVALID ("non-executable") code in different color :)

DBRO options need a DBA user

Hi,
With a new option dbro -it's required to use DBA user to compare schemes otherwise you will get this error

2018-09-02 09:04:16 INFO  DDL Filesystem v2.1 for Oracle Database, FUSE v2.9
2018-09-02 09:04:16 INFO  .. connected to database server.
2018-09-02 09:04:16 INFO  Cache validation started beacuase temppath_reused=[1] and dbro=[1]
2018-09-02 09:04:16 ERROR errcode=942||ORA-00942: table or view does not exist

It can be fixed by changing dba_objects view to all_objects view

diff --git a/src/dbro_refresh.c b/src/dbro_refresh.c
index 0c3972b..1c8ea05 100644
--- a/src/dbro_refresh.c
+++ b/src/dbro_refresh.c
@@ -109,7 +109,7 @@ int dbr_refresh_cache() {
     const char *query =
 "select o.owner, o.object_type, o.object_name, \
  to_char(o.last_ddl_time, 'yyyy-mm-dd hh24:mi:ss') as last_ddl_time\
- from dba_objects o\
+ from all_objects o\
  where generated='N'\
  and (o.object_type != 'TYPE' or o.subobject_name IS NULL)\
  and object_type IN (\

regards,
Marcin

Support for SYNONYM

Hi,
It seems like one of the missing objects in the picture is synonyms.
Do you plan to add support for those?

Obtain triggers/ from all_source

This only affects performance. Triggers are already supported in latest source, but not in 1.0 release.

Currently, the source for triggers is obtained using dbms_metadata.get_ddl.

Ignore SYS.BFILE of type TYPE

.. because it's source is never available, here is a testcase:

SQL> select count(*) from dba_objects where owner='SYS' and object_type='TYPE' and object_name='BFILE';

  COUNT(*)
----------
         1

SQL> select count(*) from dba_source where owner='SYS' and "TYPE"='TYPE' and "NAME"='BFILE';

  COUNT(*)
----------
         0

SQL> select dbms_metadata.get_ddl('TYPE', 'BFILE', 'SYS') from dual;
ERROR:
ORA-31603: object "BFILE" of type TYPE not found in schema "SYS"
ORA-06512: at "SYS.DBMS_METADATA", line 4018
ORA-06512: at "SYS.DBMS_METADATA", line 5843
ORA-06512: at line 1

dbro & execution bit

With dbro option we should never set execution bit according to object's validity.
That's because (at least) Mercurial tracks execution bit.. And if you change one object and with that change invalidate (or validate) a lot of other objects (which were not actually touched), mercurial will mark all of the invalidated (or validated) objects as changed.. We don't want that, since their source has not actually changed (just their dba_objects.status has).

File sizes

Hi Urh,

I'm doing some test of your code as I want to include it in my DevOps Oracle presentation.
I know from your comments that git doesn't work for now due to size of files set to 0.

I compiled a latest commit and this is what I can see

ls -l on file show 0 as a size

[oracle@linuxsource test121]$ ls -l /home/oracle/test121/plsql/PIORO/PROCEDURE/TEST.SQL
-rw-r--r--. 1 oracle oinstall 0 Jan 10 06:58 /home/oracle/test121/plsql/PIORO/PROCEDURE/TEST.SQL

ls -l on directory above show actual size 88

[oracle@linuxsource test121]$ ls -l /home/oracle/test121/plsql/PIORO/PROCEDURE/
total 0
-rw-r--r--. 1 oracle oinstall 88 Jan 10 06:58 TEST.SQL

Are you working on code to make it consistent now ?
If you need help, let me know and I will take a look on it. I didn't code in C for while
but maybe I will be able to help you.

Great Job !!!!

regards,
Marcin

Support for editionable objects

  1. Currently, keyword editionable is lost (ignored).

  2. It would probably be a good idea to introduce edition mount option, which would (if specified) set default edition for this session to whatever is specified.

Test scripts

I'm thinking of providing .sql file which creates test schema and a set of bash scripts which mount that schema and then perform (and validate) a set of tasks on this mounted filesystem, such as:

  • touch new-package.sql
  • rm some-package.sql
  • echo "new package content" > package.sql
  • git/hg commit
  • ...

Windows?

Hi @usrecnik
This looks very promising.
Is there any chance that ddlfs would work on Windows (with cygwin or any other Unix emulator?)

If not, what would be your suggestion to use it on Windows? Virtoualbox/docker with Ubuntu & mapped drive?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.