I'm not a PL/SQL developer but my current task at work needs me to go through a lot of them. I'm trying to learn it quick but oracle documentation seems tedious. So asking this question.
In one of the .sql script I seen,
installer.sql
##pkgstringinteger.h
##pkgstringinteger.sql
##load_policy.sql
so what does this ## do?
I know on sqlplus prompt if we have to execute any .sql file then we put # at the start. e.g.
SQL>#load_policy.sql
But was wondering what would putting it twice would do? I tried to google but it was difficult to get answer to this peculiar question.
Thanks
##foo.sql does the same thing as #foo.sql (executes the commands in that file), but looks for the file in the same directory as the calling file.
Related
I am learning shell scripting and I'm experiencing an odd issue.
When I attempt to connect to a Teradata database using BTEQ I am able to log in and run the query, but with each step (IE .LOGON, .QUIT, .EXIT, etc...) the screen shows information about the database and displays the name of the 2 files I have in my home directory.
I've highlighted a command (.LOGOFF) in green to demonstrate and I've highlighted the names of the files in yellow. Every thing else is additional information that I don't want either. I only want the results of the query.
Here is the script that I'm using. (Be gentle, it's my first script outside of the manuals.)
I've done a few dozen searches, but I can't find anything dealing with the issue I am experiencing. Thank you for any help you can offer.
I want to redeploy a package with sqlplus like that:
echo exit| sqlplus user/passwd#db #package.sql
I wonder if it would be possible to diff #package.sql with the existing package in db(if exists at all).
I'm using power shell for that.
Many thanks in advance!
I don't know whether you can do it using Power Shell. I'd
install Notepad++
then install its "Compare" plugin
use SQL Developer to easily access current package specification/body
copy/paste it into Notepad++
load package.sql into another Notepad++'s tab
compare both tabs
you'd see which lines are equal, which exist in one tab and not in another (and vice versa) - everything
If you want to do it "automatically" while running package.sql ... then
I have no idea how to do it,
might cost more than what I suggested ("cost" because you'd have to develop a program which would do that, and that takes time and effort), unless there's already some tool which lets you do it (but I don't know anything about it)
in .sql file i have 90 laksh insertion statements, file even not opening in text editor. While running it is getting very slow and after it is stuck. can anyone provide solution steps.
Run the file as a script instead of loading the file into the IDE. For example:
#C:\directory\your_file.sql
It may also help to run set feedback off; first, to suppress some of the output. If SQL Developer is still slow, try using SQL*Plus instead.
As Justin pointed out, there are better options for loading large amounts of data into Oracle. But if this is a just a one-time process, then it's probably not worth switching methods.
Hi i'm currently working on a bash script on ubuntu server where i have to specify the name of password and shadow file to update when adding user. I'm wondering how do you do it? Thanks in advance!
You've known adduser or other related command. The source code of those command may be written in C. So the simple way to know how to write it in shell script, you just need to transform C code. You can find all the things you mentioned in the question.
For me, this question is strange. Usually, shell script is used to contains a series of commands, not to solve a basic problem which is already solved.
I want to execute my bash scripts normally but no body see my source codes.
How can i encrypt my bash script?
thanks a lot.
Bash is a pure interpreted language so the interpreter (bash) can only run it if it is clear text.
You can try to obfuscate the code:
How to minify/obfuscate a bash script
On the other hand, you can restrict which users access to that code using system privileges.
Sorry to wake up a "dead horse", just wanted to share what I have done using gpg. As mentioned earlier bash can only run it (the script) if it is in clear text.
encrypt the shell script with gpg:
gpg -c <your_bash_script.sh>
This will ask you for a passphrase and confirm it.
This will create an encrypted file with a .gpg extension. the default encryption is CAST5 if you want a more strict cipher add --cipher-algo "cipher_name" (check the man pages for details)
<your_bash_script.sh.gpg>
decrypt your shell script with gpg:
gpg -d <your_bash_script.sh.gpg>
This will prompt you for the passphrase assigned to the file and display its contents in the on the screen.
if you put it all together, you have:
gpg -d <your_bash_script.sh.gpg> | bash
You can even use gpg keys
Every time you edit your script, you edit the un-encrypted version of the script or pipe the output of the decryption to a file and re-encrypt it when done.
You could use shc. Here is an example. Not really sure if this is a great place to ask this question though. Doesn't seem super programming-related. Super User might be a better place for it. :)
http://www.thegeekstuff.com/2012/05/encrypt-bash-shell-script/
Other answers and comments have already said that encryption isn't feasible so I won't go into that. I don't think that path even addresses the problem you are trying to solve.
You haven't given a practical example of what you are trying to achieve, so the suggestions below may not be sufficient.
With almost any problem it's best to start of with the simplest approach first and add complexity as needed. First of all, you may not need to do anything at all! When you execute a shell script, the process list will only show the name of the shell executing the script (bash) and the name of the script. No-one will be able to see the contents of the script this way.
If that doesn't meet your needs then the next step would be to use standard file permissions to ensure that no-one can look at the contents of the file. ie. Remove read/write/execute permissions for group and other
chmod go-rwx <name of script>
If neither of these are enough, you will have to provide more details about what you are trying to do and what your concerns are.
I recommend you try submitting your script to this site if you wish to protect it from public view.
While many will disagree with the idea of hiding the source code of a script written in an interpreted language, i understand why there's a desire for this work.
As someone who has had his work stolen many times, I just dont care if "obfuscation" or "encryption" is a taboo. As long as my script is protected and it works as it did before encryption, I'm happy. Never again will I allow someone else to take credit for my work. And no, writing my script in a compiled language is not an option. I do not know how to.
Anyway, if you do not want to use the site mentioned above, try the latest version of shc. I believe they've updated it in github to address the many security concerns others have mentioned. Type the following into google "shc github" and you'll see a host of available options you can try out.