Change system date with Oracle sql statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Reshmi Jacob
    New Member
    • Sep 2006
    • 50

    Change system date with Oracle sql statement

    Hi all,

    Can any one help me with a command by which I can change the system date thru Oracle



    Regards
    Reshmi
  • pragatiswain
    Recognized Expert New Member
    • Nov 2006
    • 96

    #2
    Oracle takes System date from the OS. Shut down Oracle, Change the OS date and restart Oracle. That will give you New Systemdate.

    If you do not Shut down/ Restart Oracle, it some time creates problems.

    Hope this helps.

    Comment

    • Reshmi Jacob
      New Member
      • Sep 2006
      • 50

      #3
      Hi

      Thanks for ur time.

      But its not the thing I want. The exact problem is when I make changes in a table, and if some condition satisfies, I will execute a trigger in which I will change the system date itself. (ie; UPDATE.... SYSDATE = '27-Nov-2006') This will create an error , then how can I change the SYSDATE ???

      Regards
      Reshmi

      Comment

      • kasibhat
        New Member
        • Nov 2006
        • 1

        #4
        Use 1)nls_format_da te

        To Change Date Format Or Use

        2)to_char, 3)or To_date

        Comment

        • pragatiswain
          Recognized Expert New Member
          • Nov 2006
          • 96

          #5
          Originally posted by kasibhat
          Use 1)nls_format_da te

          To Change Date Format Or Use

          2)to_char, 3)or To_date
          Hey,

          Reshmi is trying to change the SystemDate, not the date format.
          It can be done, using a batchfile/shell script, if you want it to be automatic.

          Comment

          • Reshmi Jacob
            New Member
            • Sep 2006
            • 50

            #6
            Originally posted by pragatiswain
            Hey,

            Reshmi is trying to change the SystemDate, not the date format.
            It can be done, using a batchfile/shell script, if you want it to be automatic.
            Hi

            Can u help me in how to execute a batch file from Oracle?

            Reshmi

            Comment

            • pragatiswain
              Recognized Expert New Member
              • Nov 2006
              • 96

              #7
              Originally posted by Reshmi Jacob
              Hi

              Can u help me in how to execute a batch file from Oracle?

              Reshmi
              sqlplus "/as sysdba"; SQL> shutdown immediate
              Stop listener as - lsnrctl stop[listener_name]

              date [New Date]

              Start listener as - lsnrctl start[listener_name]
              Start Database as - sqlplus "/as sysdba"; SQL> startup

              hope this helps.
              By the way, the above script is for Windows. what are you trying to do?
              If you ask your Oracle Admin. they will do it for you.

              Comment

              • suvam
                New Member
                • Nov 2006
                • 31

                #8
                OK , you may proceed as Pragati has told u .
                But through a DML statement like UPDATE it is not possible as SYSDATE works like a function and it can't be used in the left hand side of a = operator .

                Comment

                • kishorebagul
                  New Member
                  • Mar 2007
                  • 1

                  #9
                  Originally posted by Reshmi Jacob
                  Hi

                  Can u help me in how to execute a batch file from Oracle?

                  Reshmi

                  u can execute batch file with
                  @path/filename from sql prompt

                  Comment

                  • seraphstream
                    New Member
                    • Mar 2007
                    • 6

                    #10
                    ...uhm it seems very stange.

                    Now I try to think about it...

                    bye

                    All oracle Errors Messages

                    Oracle Forum

                    Comment

                    • vassagus
                      New Member
                      • Jun 2007
                      • 1

                      #11
                      hi Reshmi Jacob, maybe you can use this durty trick,

                      Oracle takes the date from SO, but you can also set a constant date temporality, and then set the S.O date again.

                      ALTER SYSTEM SET FIXED_DATE = '2007-01-01';

                      Done!!, you now have a constant sysdate, lol, but prolly you want to go back to the normal clock, couse this is constant and tomorroy will have the same date.

                      ALTER SYSTEM SET FIXED_DATE='non e';

                      Cool, now you have your incremental time again.

                      I hope this can help you, remember that the user must have alter system grant, and this can be dangerous depending of your porpose.

                      Good lock, and sorry for my bad english(latin guy).

                      Bye.

                      Comment

                      Working...