Disclaimer: I'm not a DBA, just a DBA-wannabe.
I have created a Directory in our Production Environment:
CREATE DIRECTORY PAY_FOLDER AS '/u01/EBSPROD/apps/apps_st/appl/cust/12.0.0/per/1.0';
GRANT READ ON DIRECTORY PAY_FOLDER TO PUBLIC;
However, when our Production Environment is cloned to a Non-Prod Instance (for example EBSDEV),
the instance name doesn't change and still stays as EBSPROD.
I would want it to be:
/u01/EBSDEV/apps/apps_st/appl/cust/12.0.0/per/1.0 when cloned over to DEV
/u01/EBSDEV/apps/apps_st/appl/cust/12.0.0/per/1.0 when cloned over to TEST
/u01/EBSUAT/apps/apps_st/appl/cust/12.0.0/per/1.0 when cloned over to UAT
Do I need a separate script to re-create these directories when i clone an instance?
Yes. The directory name is just a string; it does not know that you have embedded the instance name.
Use
CREATE OR REPLACE DIRECTORY directory_name AS'path_name';
instead of a DROP-Statement followed by a CREATE-Statement. This will keep all the grants on this directory.
It should not be too hard to create a single parameterized script that would take the DB Name or Instance name (whichever is appropriate) and build the correct directory name.
Related
So, I'm currently working on a spring-boot application that should import a database dump based on a config-file. For that I build myself an impdp-command as a String, which then gets executed in the command line. Since this application is based around directories and should work by just moving the dump-file into a specific directory, I would like to use the current directory my application is running in. As far as I know the parameter "DIRECTORY" only accepts oracle directories (created in sql with create directory 'name' as 'C:\path\'). Is there any way I could use the directory from which the command gets executed or just a windows path?
My .csv recreates on every release, and, as I understand, to keep its data unchanged between deploys I need to put it in /shared directory and simlink to it from my deploy.rb.
Is this the right route? (I have this question because I don't seem to find much info on how to do this with respect to, eg, databases, for some reason. /shared directory is mostly used for .conf files and paperclip-like directories).
When using capistrano, your application code will be "uploaded" to some directory on the server. Capistrano uses this structure:
/path_to_folder:
current - symlink to the directory with the current release
releases - contains all kept releases
shared - files that should persist between releases
So to your question - copy the .csv file somewhere into "shared" directory and then in the config/deploy.rb add this:
namespace :deploy do
task :create_symlinks do
run "ln -s #{shared_path}/something.csv #{latest_release}/db/something.csv"
end
end
after 'deploy:update_code', 'deploy:create_symlinks'
Replace "something" with the file name that you copied. You can also put the csv file into some directory under "shared" if you want to, I'd use "db" in this case. If you do so, don't forget to update path in the symlink.
If we create a directory using create or replace directory and another directory exists which has the same path will the original directory get deleted?
Nope, you can have many oracle directories which point to the same place. Creating or removing an oracle directory does nothing at the OS level, the OS directory doesn't have to exist in order to create the oracle directory.
I've read the docs and a few things still confuse me, mostly related to sync folders and database data.
I want to use the following folder structure on my host machine
ROOT
|- workFolder
||- project1
|||- project1DatabaseAndFiles
|||- project1WebRoot
||- project2
|||- project2DatabaseAndFiles
|||- project2WebRoot
||- project3
|||- project3DatabaseAndFiles
|||- project3WebRoot
And then create VM's where each VM host webroot points to the appropriate projectX/projectXWebRoot folder.
From what I've read, I can only specify one remote Sync DIR. (http://docs.vagrantup.com/v2/synced-folders/). But if I create a new VM I want to specify the project name too, thereby selecting the correct host folder.
Is what I'm describing possible using Vagrant?
If I wanted another developer to use this environment, I'd like for them to have instant access to the database structure/setup etc without having to import any SQL files. Is this possible?
I'm hoping I'm just not understanding Vagrants purpose, but this seems like a good use of shared VM's to me. Any pointers or articles that might help would be very welcome.
From what I've read, I can only specify one remote Sync DIR.
No that is not true. You can always add more shared folders. From the
manual:
This directive is used to configure shared folders on the virtual machine and may be used multiple times in a Vagrantfile.
This means you can define additional shared folders using:
config.vm.share_folder "name", "/path/on/vm", "path/on/host"
If I wanted another developer to use this environment, I'd like for them to have instant access to the database structure/setup etc without having to import any SQL files. Is this possible?
Yes, you can alter the data storage path of, say, MySQL to store it in on a share on the host so that
the data is not lost when the VM is destroyed.
However, this is not as simple as it sounds. If you're using the MySQL cookbook (again, assuming you're using MySQL), you have to modify it so that the shared folder is mounted with the uid and gid of the mysql user or otherwise the user can't write to it. You can mount a share manually like this:
mount -t vboxsf -o uid=`id -u mysql` -o gid=`id -g mysql` sharename /new/data/dir
Also, if you're using Ubuntu or Debian Wheezy, Apparmor needs to be configured differently for MySQL,
as it does not allow writes to the newly configured data directory. This can be done by writing
/new/data/dir r,
/new/data/dir/** rwk,
to /etc/apparmor/apparmor.d/local/usr.sbin.mysqld. This version of the mysql cookbook supports this behaviour already, so you can look up how it does that.
I've been experimenting lot of headaches with implementing some behavior with permission in Windows 7.
I have the following directory structure (inside PROGRAM_DATA):
C:\ProgramData\foo\
C:\ProgramData\foo\test1\
C:\ProgramData\foo\test2\
The root folder has all permission for everyone. And shall be like this because Everyone can write new files at the level of foo folder.
The test1 folder has all permission for everyone.
The test2 must have the following rule: folders/files must only be writable by Administrators, and Everyone can read. This rule shall also be applicable for the test2 folder itself.
Now, everyting works well, except for this case:
Everyone can rename the test2 folder.
Of course, this will favor that we can renamed it, create a new folder with it's same name and so on (an attack).
Is there any solution? Maybe a strange combination of permissions?