Script that runs MSI from discovered location.
Hello everyone -
Still a noob here in scripting with powershell...
We use SCCM 2012, and i'd like a script that can parse through the ccmCache folder, find the desired MSI, and the use this path to work from(parameters, etc).
Below is what i have attempted, but to no avail.
When running the below...i get the T h i s i n s t a l l a t i o n p a c k a g e c a n n o t b e o p e n e d message in the script output...further telling me that the msi cannot be found.
The purpose of this is to wrap together a "find app version" script before the below script, so where it can back out if the desired version is already installed(we have a lot of image drift in with certain apps at my company).
I know its something im missing...and ideas?
TIA
$PathtoInstall = Get-ChildItem -Path C:\windows\ccmcache\ "jre1.7.0_05-c.msi" -Recurse
Foreach ($File in $PathtoInstall) {
If ($File.Exists) {
$install = $File.Name
& cmd /c "c:\windows\system32\msiexec.exe /i" $Install
Seems that I was able to get around this with my below edits to my script.
This script will find the relevant cache folder, throw the msi into the variable, then run the cmd line arguements that you wish to run.
Thanks to all for the assistance!
randy
$PathtoInstall=Get-ChildItem-PathC:\windows\ccmcache\"jre1.7.0_05-c.msi"-Recurse
Foreach
($Filein$PathtoInstall.Directory)
If($File.Exists)
cd$PathtoInstall.Directory
&cmd/c"C:\Windows\system32\msiexec.exe
/i $PathtoInstall/qb
/lv C:\temp\JavaTESTINSTALL.log"
Similar Messages
-
Using import script to read data from another location
Hi,
I need to find a way to import, in one location, the data of all other locations (with some additional transformations) using an integration script.
I think I should be able to read from the recordset returned by farsTable, but I need to know how to find the table name that contains the data from my other locations.
Thanks in advance,
JulienFirst you will need to read the tpovlocation table to get the location key and segment key for each location to be read. You can then either read the relevent tdataseg(index) table where the index is the segment key from the location table, or alternatively you could try to access the data from the View (which i think is Vdata) in which case you you will not need the segment key.
-
How to create script that run sudo-command?
I often need to run command:
sudo "/Library/Application Support/VMware Fusion/boot.sh" --restart
This needs to be run as admin.
Can anybody tell me how to create script that will login as admin and run that command in terminal?
Or from where can I get help how to add commands to a script?
Thanks
TomiYour best bet on getting a cogent answer is to post to the Unix forum under OS X Technologies.
-
Is there a standard script that runs when a projector stops?
I know there are a couple of scripts I can use to set things up when starting a Director movie (startMovie and PrepareMovie). But are there also scripts I can use that run when the user chooses to shut down a projector? I want to run a script that sets the user's screen rez back to its original setting before shutting the projector down.
Thanks!
DeweyYes, I am looking at that one. But isn't that script activated each time a .dir movie is exited, even if it opens a different .dir movie? Or, is it only activated when the 'PROJECTOR stops?
The script I want to run should only run when you exit the projector.
Dewey -
Logging out prevented by a script that runs forever
I have a script that needs to loop forever. Unfortunately, it doesn't quit when the user logs out, blocking the logout.
How can I either test if there's a logout pending (in which case the script can exit) or actually allow a logout to kill the script?
The alternate is to execute a non-looping script automatically every few minutes, but I don't know to do that without digging using cron somehow.In a word - you're doing it wrong.
If your script looks like this:
on run
repeat
-- do something
end repeat
end run
Then your script does not give the app any time to respond to system events, such as a quit or shutdown.
Instead you should write your script using an idle handler. The idle handler runs periodically (on a schedule you set), and allows the app to respond to the system in between each iteration:
on run
-- nothing really happens here
end run
on idle
-- do something - i.e. your code goes here
return 10 -- run again in 10 seconds
end idle -
I have an Script mostly that is generated by SSMS which works with-out issue on SQL Server 2008, but when I attempt to run it on a new fresh install of SQL Server 2012 I get an Msg 8631. Internal error: Server stack limit has been reached. Please look for
potentially deep nesting in your query, and try to simplify it.
The script itself doesn't seem to be all that deep or nested. The script is large 2600 lines and when I remove the bulk of the 2600 lines, it does run on SQL Server 2012. I'm just really baffled why something that SQL Server generated with very
few additions/changes AND that WORKS without issue in SQL Server 2008 R2 would suddenly be invalid in SQL Server 2012
I need to know why my script which is working great on our current SQL Server 2008 R2 servers suddenly fails and won't run on an new SQL Server 2012 server. This script is used to create 'bulk' Replications on a large number of DBs saving a tremendous
amount of our time doing it the manual way.
Below is an 'condensed' version of the script which fails. I have removed around 2550 lines of specific sp_addarticle statements which are mostly just copy and pasted from what SQL Management Studio 'scripted' for me went I when through the Replication
Wizard and told it to save to script.
declare @dbname varchar(MAX), @SQL nvarchar(MAX)
declare c_dblist cursor for
select name from sys.databases WHERE name like 'dbone[_]%' order by name;
open c_dblist
fetch next from c_dblist into @dbname
while @@fetch_status = 0
begin
print @dbname
SET @SQL = 'DECLARE @dbname NVARCHAR(MAX); SET @dbname = ''' + @dbname + ''';
use ['+@dbname+']
exec sp_replicationdboption @dbname = N'''+@dbname+''', @optname = N''publish'', @value = N''true''
use ['+@dbname+']
exec ['+@dbname+'].sys.sp_addlogreader_agent @job_login = N''DOMAIN\DBServiceAccount'', @job_password = N''secret'', @publisher_security_mode = 1, @job_name = null
-- Adding the transactional publication
use ['+@dbname+']
exec sp_addpublication @publication = N'''+@dbname+' Replication'', @description = N''Transactional publication of database
'''''+@dbname+''''' from Publisher ''''MSSQLSRV\INSTANCE''''.'', @sync_method = N''concurrent'', @retention = 0, @allow_push = N''true'', @allow_pull = N''true'', @allow_anonymous = N''false'', @enabled_for_internet
= N''false'', @snapshot_in_defaultfolder = N''true'', @compress_snapshot = N''false'', @ftp_port = 21, @allow_subscription_copy = N''false'', @add_to_active_directory = N''false'', @repl_freq = N''continuous'', @status = N''active'', @independent_agent = N''true'',
@immediate_sync = N''true'', @allow_sync_tran = N''false'', @allow_queued_tran = N''false'', @allow_dts = N''false'', @replicate_ddl = 1, @allow_initialize_from_backup = N''true'', @enabled_for_p2p = N''false'', @enabled_for_het_sub = N''false''
exec sp_addpublication_snapshot @publication = N'''+@dbname+' Replication'', @frequency_type = 1, @frequency_interval = 1, @frequency_relative_interval = 1, @frequency_recurrence_factor = 0, @frequency_subday = 8,
@frequency_subday_interval = 1, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 0, @active_end_date = 0, @job_login = N''DOMAIN\DBServiceAccount'', @job_password = N''secret'', @publisher_security_mode = 1
-- There are around 2400 lines roughly the same as this only difference is the tablename repeated below this one
use ['+@dbname+']
exec sp_addarticle @publication = N'''+@dbname+' Replication'', @article = N''TABLE_ONE'', @source_owner = N''dbo'', @source_object = N''TABLE_ONE'', @type = N''logbased'', @description = null, @creation_script =
null, @pre_creation_cmd = N''drop'', @schema_option = 0x000000000803509F, @identityrangemanagementoption = N''manual'', @destination_table = N''TABLE_ONE'', @destination_owner = N''dbo'', @vertical_partition = N''false'', @ins_cmd = N''CALL sp_MSins_dboTABLE_ONE'',
@del_cmd = N''CALL sp_MSdel_dboTABLE_ONE'', @upd_cmd = N''SCALL sp_MSupd_dboTABLE_ONE''
EXEC sp_executesql @SQL
SET @dbname = REPLACE(@dbname, 'dbone_', 'dbtwo_');
print @dbname
SET @SQL = 'DECLARE @dbname NVARCHAR(MAX); SET @dbname = ''' + @dbname + ''';
use ['+@dbname+']
exec sp_replicationdboption @dbname = N'''+@dbname+''', @optname = N''publish'', @value = N''true''
use ['+@dbname+']
exec ['+@dbname+'].sys.sp_addlogreader_agent @job_login = N''DOMAIN\DBServiceAccount'', @job_password = N''secret'', @publisher_security_mode = 1, @job_name = null
-- Adding the transactional publication
use ['+@dbname+']
exec sp_addpublication @publication = N'''+@dbname+' Replication'', @description = N''Transactional publication of database
'''''+@dbname+''''' from Publisher ''''MSSQLSRV\INSTANCE''''.'', @sync_method = N''concurrent'', @retention = 0, @allow_push = N''true'', @allow_pull = N''true'', @allow_anonymous = N''false'', @enabled_for_internet
= N''false'', @snapshot_in_defaultfolder = N''true'', @compress_snapshot = N''false'', @ftp_port = 21, @allow_subscription_copy = N''false'', @add_to_active_directory = N''false'', @repl_freq = N''continuous'', @status = N''active'', @independent_agent = N''true'',
@immediate_sync = N''true'', @allow_sync_tran = N''false'', @allow_queued_tran = N''false'', @allow_dts = N''false'', @replicate_ddl = 1, @allow_initialize_from_backup = N''true'', @enabled_for_p2p = N''false'', @enabled_for_het_sub = N''false''
exec sp_addpublication_snapshot @publication = N'''+@dbname+' Replication'', @frequency_type = 1, @frequency_interval = 1, @frequency_relative_interval = 1, @frequency_recurrence_factor = 0, @frequency_subday = 8,
@frequency_subday_interval = 1, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 0, @active_end_date = 0, @job_login = N''DOMAIN\DBServiceAccount'', @job_password = N''secret'', @publisher_security_mode = 1
-- There are around 140 lines roughly the same as this only difference is the tablename repeated below this one
use ['+@dbname+']
exec sp_addarticle @publication = N'''+@dbname+' Replication'', @article = N''DB_TWO_TABLE_ONE'', @source_owner = N''dbo'', @source_object = N''DB_TWO_TABLE_ONE'', @type = N''logbased'', @description = null, @creation_script
= null, @pre_creation_cmd = N''drop'', @schema_option = 0x000000000803509D, @identityrangemanagementoption = N''manual'', @destination_table = N''DB_TWO_TABLE_ONE'', @destination_owner = N''dbo'', @vertical_partition = N''false''
EXEC sp_executesql @SQL
fetch next from c_dblist into @dbname
end
close c_dblist
deallocate c_dblist
George P Botuwell, ProgrammerHi George,
Thank you for your question.
I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.
Thank you for your understanding and support.
If you have any feedback on our support, please click
here.
Allen Li
TechNet Community Support -
HOw do i tear down VOD Sessions that are older than 4 hours
NOTE: When the VOD Session Manager is a USRM, Cisco refers to this USRM as a VSM.
Here is an explanation of how the VOD Session Manager (VSM) initiates a release of VOD sessions that are older than 4 hours (configurable). The algorithm described below is similar to the releaseOldSessions script on the DNCS that many of our customers are familiar with. Both release VOD sessions that are older than 4 hours old. Also, the VSM has a retry and session audit mechanism built into its algorithm that is absent in the releaseOldSessions script on the DNCS. The main difference is that this functionality is built into the VSM, but the releaseOldSessions script must either be run manually on the DNCS or put into the DNCS crontab. The VSM will make the decision to release a VOD session base on age, typically configured for 4 hours, and then the VSM will send up to 3 teardown requests to the Edge Resource Manager (ERM). NOTE: Both the VSM and ERM are Linux servers running Cisco USRM software.
The “releaseOldSessions” algorithm is configured on the VSM in the Web UI under Applications.VodSm.Configuration as shown in the screen shot below:
Applications.VodSm.Configuration.SessionTimeout = 14,400 seconds (default, configurable)
ReleaseRetryCount = 3 (default, not configurable)
ALGORITHM: The VSM, being the VOD Session Manager, will send a session release request to the appropriate Edge Resource Manager (ERM) based on the configured “SessionTimeout”. By default this value is 14,400 seconds (4 hours, configurable). When the age of a VOD session reaches the SessionTimeout, the VSM will locate the appropriate ERM and send it a session release request for that session. If the ERM fails to acknowledge this release request, the VSM will retry the session release for the number of times configured in ReleaseRetryCount, which is 3. NOTE: Cisco Development has chosen a value of 3 for this parameter (the ReleaseRetryCount is not configurable). If after the 3rd release retry, the VSM still does not have an acknowledgement of session teardown from the ERM, the VSM will initiate a session audit of that ERM as a final attempt to tear down the session. -
Script that runs very slow when exporting output to XLS file
I am using TOAD for oracle to export result to XLS. Need help on this script to chec how can I speed up the process:
select a.div, a.zname, a.MBr, a.Loc,a.lname, b.mid as SLID, c.slname, a.FDID, b.FName as FDNAME,
a.apptdate,b."Contact Nos",
b."Credit Line",b."PastDue Acct"
From
select zname, Loccode,
lname,
FDID,
ApptDate,
div,
MainBr
from tbl1
)a,
select distid,name,managerid, dayphoneno || ' ' || mobilephoneno as "Contact Nos",
street || ' ' || zip as Address,
dealercreditamt as "Credit Line",
pastdueamt as "PastDue Acct"
from tbl2@DB2
)b,
select distid slid,name slname from tbl2@DB2
)c
where a.FDID=b.DISTID
and b.distid=c.slid;
SQL> @?/RDBMS/ADMIN/UTLXPLS
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 2137K| 515M| 243K|
| 1 | HASH JOIN | | 2137K| 515M| 243K|
| 2 | TABLE ACCESS FULL | tbl1 | 62280 | 4074K| 66 |
| 3 | HASH JOIN | | 2137K| 379M| 236K|
| 4 | REMOTE | | 2137K| 124M| 114K|
| 5 | REMOTE | | 2137K| 254M| 114K|
--------------------------------------------------------------------------mrp wrote:
I am using TOAD for oracle to export result to XLS. Need help on this script to chec how can I speed up the process:XLS is a poor output format for larger result sets. Why? because all tools that I know use a kind of cell-by-cell processing to fill the fetched values into Excel.
It is way faster to output into any kind of text (CSV) format. -
How to create script that run sudo-command, via automator?
Hi
I'd want to create script to automate one command I need quite often. I just can't get this to work.
I'm not using english OS, but I think this is what I do. In automator I choose Utilities -> Run script
Here's the script I try to run:
sudo "/Library/Application Support/VMware Fusion/boot.sh --restart"
I found some tip to do it like this:
do shell script "sudo /Library/Application Support/VMware Fusion/boot.sh --restart password "pass" with administrator privileges
Where pass is my admin password.
This does not work, either.
Could anybody help me on this?
Thanks...
Tomi Toivonen
Message was edited by: TomiThis is not working. What's wrong?
What's wrong is that the '--restart' is a parameter for boot.sh, and therefore needs to be included within the quotes.
Additionally, the shell uses spaces to divide parameters, so the spaces in the command will make it appear as multiple commands - '/Library/Application', 'Support/VMware' and 'Fusion/boot.sh'. You need to escape them using a backslash:
<pre class=command>do shell script "/Library/Application\ Support/VMware\ Fusion/boot.sh --restart" password "pass" with administrator privileges</pre>
If it's outside of the quotes it would be interpreted as a parameter to 'do shell script' and it won't know what to do with that. -
Trouble running file from untrusted location
I have a new Windows Server 2012 box running on a network, it was added to an existing Server 2003 domain and then promoted to be the master DC. The clients are all Windows 7 Pro x64. Everything was working just fine until their software vendor released
an update they installed for some scanning software - TouchChart.
When they try to launch TouchChart, every time it first goes to a UAC prompt asking for an administrator password, followed by credentials for the remote server, followed by citrix credentials
The problem is the prompt for the administrator password. The shortcut they click on goes to a 10.x.x.x IP address that is outside of the network ( i believe it is linked via a VPN to the hospital ) - ex:
\\10.x.x.x\TouchChart\ImpactS.exe
I talked to the TouchChart support and apparently they don't ever run into this problem of the administrator access UAC prompt, it's supposed to be a one time thing and then never show again. This of course shows every time they launch the software and i
can't leave it like that because i don't want to give the users the administrator password.
I tried promoting a user to have admin rights and that did not make it go away. I have done some digging into group policies but haven't come across anything that would allow this shortcut to run without the UAC prompt. Anyone have any ideas?
TL:DR: How do i get \\10.x.x.x\program.exe to run on a domain without UAC administrator prompt?Hi,
Thank you for your posting.
According to your description, problems occurred after installed an update, does uninstall this update solve this issue?
More importantly, since we are not familiar with Touch Chart, it will be much more helpful if you refer to the experts on corresponding forum below:
http://www.sencha.com/forum/
Thank you for your understanding and support.
Best Regards,
Amy Wang -
Issue with create controlfile script that was generated from trace file
Hi All,
I am racking my brans here as cannot seem to fatham this one out. Having backed up control file to trace, then deleted all datafiles, control files, and redo log files, I then ran the following and received the below error:
SQL> STATUP NOMOUNT
ORACLE instance started.
Total System Global Area 289406976 bytes
Fixed Size 1248576 bytes
Variable Size 88081088 bytes
Database Buffers 192937984 bytes
Redo Buffers 7139328 bytes
SQL> CREATE CONTROLFILE SET DATABASE "TEST" RESETLOGS ARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\REDO01.LOG' SIZE 50M,
9 GROUP 2 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\REDO02.LOG' SIZE 50M,
10 GROUP 3 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\REDO03.LOG' SIZE 50M
11 DATAFILE
12 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\SYSTEM01.DBF',
13 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\UNDOTBS01.DBF',
14 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\SYSAUX01.DBF',
15 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\USERS01.DBF'
16 CHARACTER SET WE8MSWIN1252;
CREATE CONTROLFILE SET DATABASE "TEST" RESETLOGS ARCHIVELOG
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01565: error in identifying file
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\SYSTEM01.DBF'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified.
I am able to restore a control file using [RMAN> restore controlfile to '....' ] and then mount the database without problems one the CF restore has taken place, it is just when I attempt to create control file using the able commands that I get the preceding error.
As this control file statement that is attepting to create a control file has never had any information about datafiles is this why I am seeing the error?
Have checked metalink & web but yet to find a reason why this is occuring. Please advise.
Thanks,
AndrewHi,
You deletd all the data files that is the issue. So it is complaining that it can not find system tablespace datafile. If you just wanted to recreate the controlfile then just delete control file. Why did you delete data files.
Regards
Generetaed control trace flle is used to re-create the control file. This not not a way to create/restore data files. They should exist for control file to be created.
Edited by: skvaish1 on Nov 5, 2009 4:36 PM -
Running python script with system arguments from applescript
Hi,
I am trying to run a python code from within applescript. A string should be passed as an argument to the python script, i.e. from the terminal, I would do the following
cd /Users/thatsme/Library/Scripts/myfolder
python my_python_file.py abcdefg
There are two ways I figure I could do this in applescript. "abcdefg" are contained in the variable strNote
a) directly:
do shell script "cd /Users/thatsme/Library/Scripts/myfolder; python my_python_file.py " & strNote
b) calling Terminal
tell application "Terminal"
activate
do script "cd /Users/claushaslauer/Library/Scripts/OO_latex; python my_python_file.py " & strNote
end tell
I would prefer option a) as I don't really want to have Terminal windows popping up. The strange thing is, that I see in the applescript results window the result of the print statements in the python script, but no output is generated (the python script contains a few os.system() commands.
Option b) does what it is supposed to be doing, however, applescript does not wait until the script is finished running.
Why does option a) nor work, and what do I need to change to make it work?Thank you guys for your help, this is really weird.
Here is my full applescript
set strNoteQ to "1+1=2"
(* for whatever reason, this does not work *)
do shell script "cd /Users/claushaslauer/Library/Scripts/OO_latex; python create_latex_pdf.py " & strNoteQ
Below is my python skript.
When I call it as
python create_latex_pdf.py 1+1=2
it creates a wonderful pdf.
With the applescript above, it prints the print statements, it also generates the latex file temp.tex -- correctly, so I assume the string in this example is ok.
However, it does not execute the latex related commands (the three os.system calls)
Is it not a good idea / not possible to execute os.system in a python script that is called from applescript? <sorry if I had brought all the attention to the string issue>
here is the python script:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import datetime
import time
def main():
str_latex_note = sys.argv[1]
print "%s" % str_latex_note
preamble = """\documentclass{article}
\usepackage{amsmath,amssymb}
\pagestyle{empty}
\\begin{document}
{\huge
%s
\end{document}"""% (str_latex_note)
## write latex file
cur_path = r'/Users/mypath/Library/Scripts/OO_latex'
cur_file = "temp.tex"
fobj = open(os.path.join(cur_path, cur_file), 'w')
fobj.writelines(preamble)
fobj.close()
## process latex file
print cur_path
os.chdir(cur_path)
cmd = 'latex temp.tex'
print cmd
print "running latex"
os.system(cmd)
cmd2 = 'dvips -E -f -X 1200 -Y 1200 temp.dvi > temp.ps'
print "running dvips"
os.system(cmd2)
cmd3 = 'epstopdf temp.ps'
print "running epstopdf"
os.system(cmd3)
print "done!"
if __name__ == '__main__':
main() -
A simple script that removes older packages from cache dir
Hello all,
I wrote a small bash script that removes packages (from cachedir /var/cache/pacman/pkg), older than the ones available in repositories (eg. if the current version of pacman is 2.6.3, it will remove pacman-2.6.2 from cachedir). It implements the functionality of debian's 'apt-get autoclean'.
Get it from http://www.kegep.tuc.gr/~manolis/archlinux/cleanold.sh.thanks a lot for sharing this
-
Help! Script that works in 8.1.7 does not work in 9.2.0
I have a generic hot backup script that runs well in our 8i environment where I source the username and password for SYS from a secured txt file. However I could not get the script to work in our recently installed 9.2.0 environment.
Below is an extract of the hot backup script:
# Set environment
. ${HOME}/BACKUP/${DBNAME}.env
CONNECT_STRING=`${HOME}/admin/Util/syspass.sh sys $DBNAME`
export CONNECT_STRING
#Define some commands and files
SQLPLUS="${ORACLE_HOME}/bin/sqlplus -s ${CONNECT_STRING}"
TIME_STAMP=`date +"%d-%b-%Y"`
# Test for duplicate filenames
$SQLPLUS <<-EOF
var numfiles number;
BEGIN
SELECT count(*) into :numfiles
FROM dba_data_files a, dba_data_files b
WHERE a.file_name != b.file_name
AND SUBSTR(a.file_NAME, INSTR(a.file_name, '/', -1) + 1)
= SUBSTR(b.file_NAME, INSTR(b.file_name, '/', -1) + 1);
END;
exit :numfiles
EOF
FILE_ERROR=$?
echo "Number of duplicate files $FILE_ERROR"
if [ $FILE_ERROR -gt 0 ]; then
echo "Aborting, ... $FILE_ERROR duplicate filenames"
exit
fi
As per the extract above,
in our 8.1.7 environment,
(1) the command CONNECT_STRING=`${HOME}/admin/Util/syspass.sh sys $DBNAME`
will result in CONNECT_STRING=sys/xxxxxx@<sid>
(2) the command SQLPLUS="${ORACLE_HOME}/bin/sqlplus -s ${CONNECT_STRING}"
will result in SQLPLUS=/usr/oracle/product/8.1.7/bin/sqlplus -s sys/xxxxxx@<sid>
(3) and when issue $SQLPLUS <<-EOF
it connects fine and execute the procedure successfully.
in Oracle 9.2.0,
(1) the command CONNECT_STRING=`${HOME}/admin/Util/syspass.sh sys $DBNAME`
works fine with result same as in 8.1.7 - CONNECT_STRING=sys/xxxxxx@<sid>
(2) the command SQLPLUS="${ORACLE_HOME}/bin/sqlplus -s ${CONNECT_STRING}"
works fine with result SQLPLUS=/usr/oracle/product/9.2.0/bin/sqlplus -s sys/xxxxxx@<sid>
(3) However, when issue $SQLPLUS <<-EOF returns an error:
ERROR:
ORA-28009: connection to sys should be as sysdba or sysoper
How can I fix that??
Is it because of the username/password structure (sys/xxxxxx@<sid>)??
I would like to keep such username/password format if possible.
I have also tried to hard coded the username/password for variable SQLPLUS as:
SQLPLUS="/usr/oracle/product/9.2.0/bin/sqlplus -S '/ as sysdba'"
But it still doesn't work when issue $SQLPLUS, it returns the following:
Usage: SQLPLUS [ [<option>] [<logon>] [<start>] ]
where <option> ::= -H | -V | [ [-L] [-M <o>] [-R <n>] [-S] ]
<logon> ::= <username>[<password>][@<connect_string>] | / | /NOLOG
<start> ::= @<URI>|<filename>[.<ext>] [<parameter> ...]
"-H" displays the SQL*Plus version banner and usage syntax
"-V" displays the SQL*Plus version banner
"-L" attempts log on just once
"-M <o>" uses HTML markup options <o>
"-R <n>" uses restricted mode <n>
"-S" uses silent mode
Any ideas as to how to have the script run in 9.2.0??
Your help is much appreciated.Hi, I tried CJs suggestion; however it still doesnt work for me.
I tried assigning the command line to a variable, I tried to log in directly from the command line, and both dont work (see below). What did I do wrong??
$ SQLPLUS="/usr/oracle/product/9.2.0/bin/sqlplus -S \"sys/xxxxxx@<sid> as sysdba\""
$ echo $SQLPLUS
/usr/oracle/product/9.2.0/bin/sqlplus -S "sys/xxxxxx@<sid> as sysdba"
$ $SQLPLUS
Usage: SQLPLUS [ [<option>] [<logon>] [<start>] ]
where <option> ::= -H | -V | [ [-L] [-M <o>] [-R <n>] [-S] ]
<logon> ::= <username>[<password>][@<connect_string>] | / | /NOLOG
<start> ::= @<URI>|<filename>[.<ext>] [<parameter> ...]
"-H" displays the SQL*Plus version banner and usage syntax
"-V" displays the SQL*Plus version banner
"-L" attempts log on just once
"-M <o>" uses HTML markup options <o>
"-R <n>" uses restricted mode <n>
"-S" uses silent mode
$ sqlplus "sys/xxxxxx@<sid> as sysdba"
SQL*Plus: Release 9.2.0.4.0 - Production on Wed Mar 24 08:53:05 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
ERROR:
ORA-01031: insufficient privileges -
Script that works in 8.1.7 does not work in 9.2.0
I have a generic hot backup script that runs well in our 8i environment where I source the username and password for SYS from a secured txt file. However I could not get the script to work in our recently installed 9.2.0 environment.
Below is an extract of the hot backup script:
# Set environment
. ${HOME}/BACKUP/${DBNAME}.env
CONNECT_STRING=`${HOME}/admin/Util/syspass.sh sys $DBNAME`
export CONNECT_STRING
#Define some commands and files
SQLPLUS="${ORACLE_HOME}/bin/sqlplus -s ${CONNECT_STRING}"
TIME_STAMP=`date +"%d-%b-%Y"`
# Test for duplicate filenames
$SQLPLUS <<-EOF
var numfiles number;
BEGIN
SELECT count(*) into :numfiles
FROM dba_data_files a, dba_data_files b
WHERE a.file_name != b.file_name
AND SUBSTR(a.file_NAME, INSTR(a.file_name, '/', -1) + 1)
= SUBSTR(b.file_NAME, INSTR(b.file_name, '/', -1) + 1);
END;
exit :numfiles
EOF
FILE_ERROR=$?
echo "Number of duplicate files $FILE_ERROR"
if [ $FILE_ERROR -gt 0 ]; then
echo "Aborting, ... $FILE_ERROR duplicate filenames"
exit
fi
As per the extract above,
in our 8.1.7 environment,
(1) the command CONNECT_STRING=`${HOME}/admin/Util/syspass.sh sys $DBNAME`
will result in CONNECT_STRING=sys/xxxxxx@<sid>
(2) the command SQLPLUS="${ORACLE_HOME}/bin/sqlplus -s ${CONNECT_STRING}"
will result in SQLPLUS=/usr/oracle/product/8.1.7/bin/sqlplus -s sys/xxxxxx@<sid>
(3) and when issue $SQLPLUS <<-EOF
it connects fine and execute the procedure successfully.
in Oracle 9.2.0,
(1) the command CONNECT_STRING=`${HOME}/admin/Util/syspass.sh sys $DBNAME`
works fine with result same as in 8.1.7 - CONNECT_STRING=sys/xxxxxx@<sid>
(2) the command SQLPLUS="${ORACLE_HOME}/bin/sqlplus -s ${CONNECT_STRING}"
works fine with result SQLPLUS=/usr/oracle/product/9.2.0/bin/sqlplus -s sys/xxxxxx@<sid>
(3) However, when issue $SQLPLUS <<-EOF returns an error:
ERROR:
ORA-28009: connection to sys should be as sysdba or sysoper
How can I fix that??
Is it because of the username/password structure (sys/xxxxxx@<sid>)??
I would like to keep such username/password format if possible.
I have also tried to hard coded the username/password for variable SQLPLUS as:
SQLPLUS="/usr/oracle/product/9.2.0/bin/sqlplus -S '/ as sysdba'"
But it still doesn't work when issue $SQLPLUS, it returns the following:
Usage: SQLPLUS [ [<option>] [<logon>] [<start>] ]
where <option> ::= -H | -V | [ [-L] [-M <o>] [-R <n>] [-S] ]
<logon> ::= <username>[<password>][@<connect_string>] | / | /NOLOG
<start> ::= @<URI>|<filename>[.<ext>] [<parameter> ...]
"-H" displays the SQL*Plus version banner and usage syntax
"-V" displays the SQL*Plus version banner
"-L" attempts log on just once
"-M <o>" uses HTML markup options <o>
"-R <n>" uses restricted mode <n>
"-S" uses silent mode
Any ideas as to how to have the script run in 9.2.0??
Your help is much appreciated.My first comment is that even though you are using a secure encrypted text file, putting the SYS password on the command line can make the password available to anyone on the server who can perform a ps command:
shvec320 ECD2 /u01/home/oracle/cronscripts $ sqlplus mark/mark4s@dbnm
SQL*Plus: Release 8.1.7.0.0 - Production on Wed Mar 24 16:47:17 2004
(c) Copyright 2000 Oracle Corporation. All rights reserved.
Connected to:
Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production
SQL> !ps -ef | grep mark
oracle 25494 25078 0 16:47:17 pts/4 0:00 sqlplus mark/mark4s@dbnm
oracle 25497 25494 0 16:47:23 pts/4 0:00 grep mark
Consider putting the connect string in the SQL script:
sqlplus /nolog <<-EOF
connect ${CONNECT_STRING}
var numfiles number;
BEGIN
SELECT count(*) into :numfiles
FROM dba_data_files a, dba_data_files b
WHERE a.file_name != b.file_name
AND SUBSTR(a.file_NAME, INSTR(a.file_name, '/', -1) + 1)
= SUBSTR(b.file_NAME, INSTR(b.file_name, '/', -1) + 1);
END;
exit :numfiles
EOF
Starting in Oracle 9 (others will correct me if I am wrong) you cannot connect to the sys account without specifying as SYSDBA or SYSOPER.
My testing (9.2.0.3) resulted in your ORA-1013 using "sys/password@dbname as sysdba". Using "sys/password as sysdba" works just fine. I seem to remember if you want to use @dbname, you will need to use password file authentication instead of OS authentication.
My suggestion -if possible - is to use plain "connect / as sysdba" in your SQL Script and have ORACLE_HOME and ORACLE_SID set correctly in your environment (do it in ${HOME}/BACKUP/${DBNAME}.env) :
sqlplus /nolog <<-EOF
connect / as sysdba;
var numfiles number;
BEGIN
SELECT count(*) into :numfiles
FROM dba_data_files a, dba_data_files b
WHERE a.file_name != b.file_name
AND SUBSTR(a.file_NAME, INSTR(a.file_name, '/', -1) + 1)
= SUBSTR(b.file_NAME, INSTR(b.file_name, '/', -1) + 1);
END;
exit :numfiles
EOF
HTH
Maybe you are looking for
-
I got a message from Apple a couple of weeks ago to "download Mavericks for free!" and figured, why not? What I didn't anticipate was that my Photoshop CS4 would stop working immediately afterwards, a fact that has disrupted my work and caused big pr
-
I am having trouble copying files from disk to disk, help.
I have a Dual 2 GHz PowerPC G5 running Tiger 10.4.3. I am having a problem copying files since I installed Tiger. I am trying to copy from drive "LaCie d2 195 GB", this is a Firewire 800 external drive, to drive "250GB HD", this is an internal drive.
-
When I click on a link to a pdf. a new window opens and then it says "Done" at the bottom, but the page is completely blank. This happens every time - I am never able to view them.
-
Error 1015 every time i try to restore
my iphone does not work...it freezes within a minute...no applications work....even wen i hold the power and home button for 10 seconds and after it restarts it freezes...please help
-
No email access to iCloud account
My iCloud account is different from my iPhone Apple ID and don't remember my iCloud password. I no longer have access to the iCloud email anymore so I'm unable to delete my iCloud account to use my current iCloud account. How am I able to change it w