Best script for recreating control file
Hi
Yesterday I had a lot of fun trying to refresh a Dev db with an inconsistent backup (just learned that the offline backup from that night finished late and not before the db was started up again, thus making datafile inconsistent).
Today I will try again. I am waiting for the tape backup to finish restoring to the Dev datafile directory.
I would love to know if there is a template out there, or if we can agree here, for the best standard for recreating a control file through a @script.
I will include the one I intend to use here, minus the datafiles.
I am using the RESETLOGS, since we are using :"SET" database.
STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "DEV" RESETLOGS ARCHIVELOG
-- SET STANDBY TO MAXIMIZE PERFORMANCE
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 500
MAXINSTANCES 1
MAXLOGHISTORY 19285
LOGFILE
GROUP 1 (
'/oradbi1/oracle/proddata/log01a.dbf',
'/oradbi1/oracle/proddata/log01b.dbf'
) SIZE 10M,
GROUP 2 (
'/oradbi1/oracle/proddata/log02a.dbf',
'/oradbi1/oracle/proddata/log02b.dbf'
) SIZE 10M,
GROUP 3 (
'/oradbi1/oracle/proddata/log03a.dbf',
'/oradbi1/oracle/proddata/log03b.dbf'
) SIZE 10M
-- STANDBY LOGFILE
DATAFILE
'/oradbi1/oracle/proddata/system01.dbf',
'/oradbi1/oracle/proddata/applsysd09.dbf',
'/oradbi1/oracle/proddata/bend06.dbf'
CHARACTER SET US7ASCII
RECOVER DATABASE USING BACKUP CONTROLFILE
ALTER DATABASE OPEN RESETLOGS;
ALTER TABLESPACE TEMP ADD TEMPFILE '/oradbi1/oracle/proddata/tmp04.dbf'
SIZE 2040M REUSE AUTOEXTEND OFF;
ALTER TABLESPACE TEMP ADD TEMPFILE '/oradbi1/oracle/proddata/tmp03.dbf'
SIZE 2040M REUSE AUTOEXTEND OFF;
ALTER TABLESPACE TEMP ADD TEMPFILE '/oradbi1/oracle/proddata/tmp02.dbf'
SIZE 2040M REUSE AUTOEXTEND ON NEXT 10485760 MAXSIZE 32767M;
ALTER TABLESPACE TEMP ADD TEMPFILE '/oradbi1/oracle/proddata/tmp01.dbf'
SIZE 2000M REUSE AUTOEXTEND OFF;
If anyone can see room for improvement on this, please let us know.
Thanks.
AIX 5.2
Oracle 9.2
I normally break it up into seperate scripts (even though the "trace" file generates a single script file).
1. The first is the CREATE CONTROLFILE itself. If successful , it also mounts the database.
The most important portion is to validate that we do have ALL the datafiles included.
(eg if you are generating from an old controlfile backup and some new datafile(s) have been added since that backup you had better ensure that you add them to the script , else the RECOVER DATABASE will ignore them and they will be unrecoverable after the OPEN RESETLOGS !)
2. The next portion is the RECOVER DATABASE USING BACKUP CONTROLFILE which I never run non-interactively.
Always ensure that it is NOT an interactive run. If you really have more than a dozen archivelogs to apply, then you could just enter AUTO after supplying the first 3 or 4 archivelogs and wait for the RECOVER DATABASE to "error" out after it applies the last archivelog.
3. The next portion is a manual RECOVER to apply any Archivelogs that couldn't be applied by the AUTO -- eg Archives that weren't on disk but which I've restored OR the actual last Active/Current Online Redo Logs that hadn't been applied.
between step 3 and step 4,
to be safe : I could SHUTDOWN (it is MOUNTED but not OPEN) and take a Cold Backup of the database files and controlfiles. -- This can help me retry a RESETLOGS or restore a datafile that I might have mistakenly excluded from the CREATE CCF script
and re-"recover" database -- meaning that Oracle will recover that datafile alone.
4. Finally I review the alert.log, satisfy myself that I have applied all archivelogs and then manually issue the ALTER DATABASE OPEN RESETLOGS.
5. Now I add TEMPFILEs (if 10g hasn't done it "automagically")
6. If I have time, take a Cold Backup OR initiate a Hot Backup asap.
I know that 10g now provides supported methods of recovering through a RESETLOGS, based on Incarnation ID, ... but still , old habits and old commands die hard.
Have I answered your question about how to format the CREATE CCF ? No. But I've just added some inputs on how I prefer the next few steps be done.
Hemant K Chitale
http://hemantoracledba.blogspot.com
Edited by: Hemant K Chitale on Oct 22, 2008 10:05 PM
Added the addition of TEMPFILEs
Edited by: Hemant K Chitale on Oct 22, 2008 10:20 PM
Corrected step 2 to be "Always ensure that it is NOT an interactive run"
Similar Messages
-
Best application for cleaning my files
Best application for cleaning my files?
How to maintain a Mac
1. Make redundant backups, keeping at least one off site at all times. One backup is not enough. Don’t back up your backups; make them independent of each other. Don’t rely completely on any single backup method, such as Time Machine. If you get an indication that a backup has failed, don't ignore it.
2. Keep your software up to date. In the Software Update preference pane, you can configure automatic notifications of updates to OS X and other Mac App Store products. Some third-party applications from other sources have a similar feature, if you don’t mind letting them phone home. Otherwise you have to check yourself on a regular basis. This is especially important for complex software that modifies the operating system, such as device drivers. Before installing any Apple update, you must check that all such modifications that you use are compatible.
3. Don't install crapware, such as “themes,” "haxies," “add-ons,” “toolbars,” “enhancers," “optimizers,” “accelerators,” “extenders,” “cleaners,” "doctors," "tune-ups," “defragmenters,” “firewalls,” "barriers," “guardians,” “defenders,” “protectors,” most “plugins,” commercial "virus scanners,” "disk tools," or "utilities." With very few exceptions, this stuff is useless, or worse than useless.
The more actively promoted the product, the more likely it is to be garbage. The most extreme example is the “MacKeeper” scam.
As a rule, the only software you should install is that which directly enables you to do the things you use a computer for — such as creating, communicating, and playing — and does not modify the way other software works. Use your computer; don't fuss with it.
Never install any third-party software unless you know how to uninstall it. Otherwise you may create problems that are very hard to solve.
The free anti-malware application ClamXav is not crap, and although it’s not routinely needed, it may be useful in some environments, such as a mixed Mac-Windows enterprise network.
4. Beware of trojans. A trojan is malicious software (“malware”) that the user is duped into installing voluntarily. Such attacks were rare on the Mac platform until sometime in 2011, but are now increasingly common, and increasingly dangerous.
There is some built-in protection against downloading malware, but you can’t rely on it — the attackers are always at least one day ahead of the defense. You can’t rely on third-party protection either. What you can rely on is common-sense awareness — not paranoia, which only makes you more vulnerable.
Never install software from an untrustworthy or unknown source. If in doubt, do some research. Any website that prompts you to install a “codec” or “plugin” that comes from the same site, or an unknown site, is untrustworthy. Software with a corporate brand, such as Adobe Flash Player, must be acquired directly from the developer. No intermediary is acceptable, and don’t trust links unless you know how to parse them. Any file that is automatically downloaded from a web page without your having requested it should go straight into the Trash. A website that claims you have a “virus,” or that anything else is wrong with your computer, is rogue.
In OS X 10.7.5 or later, downloaded applications and Installer packages that have not been digitally signed by a developer registered with Apple are blocked from loading by default. The block can be overridden, but think carefully before you do so.
Because of recurring security issues in Java, it’s best to disable it in your web browsers, if it’s installed. Few websites have Java content nowadays, so you won’t be missing much. This action is mandatory if you’re running any version of OS X older than 10.6.8 with the latest Java update. Note: Java has nothing to do with JavaScript, despite the similar names. Don't install Java unless you're sure you need it. Most users don't.
5. Don't fill up your boot volume. A common mistake is adding more and more large files to your home folder until you start to get warnings that you're out of space, which may be followed in short order by a boot failure. This is more prone to happen on the newer Macs that come with an internal SSD instead of the traditional hard drive. The drive can be very nearly full before you become aware of the problem. While it's not true that you should or must keep any particular percentage of space free, you should monitor your storage consumption and make sure you're not in immediate danger of using it up. According to Apple documentation, you need at least 9 GB of free space on the startup volume for normal operation.
If storage space is running low, use a tool such as the free application OmniDiskSweeper to explore your volume and find out what's taking up the most space. Move rarely-used large files to secondary storage.
6. Relax, don’t do it. Besides the above, no routine maintenance is necessary or beneficial for the vast majority of users; specifically not “cleaning caches,” “zapping the PRAM,” "resetting the SMC," “rebuilding the directory,” "defragmenting the drive," “running periodic scripts,” “dumping logs,” "deleting temp files," “scanning for viruses,” "purging memory," "checking for bad blocks," or “repairing permissions.” Such measures are either completely pointless or are useful only for solving problems, not for prevention.
The very height of futility is running an expensive third-party application called “Disk Warrior” when nothing is wrong, or even when something is wrong and you have backups, which you must have. Disk Warrior is a data-salvage tool, not a maintenance tool, and you will never need it if your backups are adequate. Don’t waste money on it or anything like it. -
Best ereader for non DRM files epub mobi pdf
What is the best ereader for non DRM files epub mobi pdf
You could give Bookviser a try. Once installed you can create a Bookviser account and upload your ebooks to your library. It supports Epub FB2 and text.
http://www.windowsphone.com/en-gb/store/app/bookviser/25bef109-9a3a-44a4-ba58-177cd642d143
Ray. -
Need Shell Script for picking the files
Hi,
I want to write a shell script for piking the files in a sequence order (according to filename with time stamp) from the sorce FTP server ..
Requirement is in the source directory I'm getting files (Jain_1.xml , Jjain_2.xml, Jain_3.xml .. ect..) at present my file adapter is picking all the files at a time but i want to pick one by one... that to first i want to Jain_1.xml after finish the processing of the file then only my file adapter should pick the next file ( Jain_2.xml ) .
so.. all the forum mates suggest me to write a shell script.. but where i have to write the s hell script. and where i have to deploy this script.... my Xi is running on UNIX ... so please sugest me the procedure ...
Regards
JainHi,
Why dont you use the option EOIO in which files will be picked up in order and will be proccessed in sequence....one after another....
Regards,
Sreeni. -
Unable to recreate control file.
Hello experts.
I'm trying to recreate controlfile in oracle database 10.2 using trace file. by during running script it shows ERROR at line 8: ORA-01967: invalid option for CREATE CONTROLFILE
my script create control file script below. please help
============================================================
CREATE CONTROLFILE REUSE DATABASE "TSH1" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/TSH1/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/app/oracle/oradata/TSH1/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/app/oracle/oradata/TSH1/redo03.log' SIZE 50M BLOCKSIZE 512
DATAFILE
'/u01/app/oracle/oradata/TSH1/system01.dbf',
'/u01/app/oracle/oradata/TSH1/undotbs01.dbf',
'/u01/app/oracle/oradata/TSH1/sysaux01.dbf',
'/u01/app/oracle/oradata/TSH1/users01.dbf',
'/u01/app/oracle/oradata/TSH1/oradaxmldb_ts.dbf'
CHARACTER SET WE8ISO8859P1
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CHANNEL','DEVICE TYPE DISK FORMAT ''/backup/%U''');
RECOVER DATABASE
ALTER SYSTEM ARCHIVE LOG ALL;
ALTER DATABASE OPEN;
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/TSH1/temp01.dbf' REUSE;Hi
Just remove below lines from scripts and run again and please use set instead of reuse in the create control file staetment .
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CHANNEL','DEVICE TYPE DISK FORMAT ''/backup/%U''');
RECOVER DATABASE
ALTER SYSTEM ARCHIVE LOG ALL;
ALTER DATABASE OPEN;
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/TSH1/temp01.dbf' REUSE;
Regards
Shivendra Narain Nirala -
Best practice for version control
Hi.
I'm setting up a file share, and want some sort of version control on the file share. What's the best practice method for this sort of thing?
I'm coming at this as a subversion server administrator, and in subversion people keep their own copy of everything, and occasionally "commit" their changes, and the server keeps every "committed" version of every file.
I liked subversion because: 1) users have their own copy, if they are away from the office or make a big oops mistake, it doesn't ever hit the server, and 2) you can lock a file to avoid conflicts, and 3) if you don't lock the file and a conflict (two simultaneous edits) occur, it has systems for dealing with conflicts.
I didn't like subversion because it adds a level of complexity to things -- and many people ended up with critical files that should be shared on their own hard drives. So now I'm setting up a fileshare for them, which they will use in addition to the subversion repository.
I guess I realize that I'll never get full subversion-like functionality in a file share. But through a system of permissions, incremental backups and mirroring (rsync, second-copy for windows users) I should be able to allow a) local copies on user's hard drives, b) control for conflicts (locking, conflict identification), and keeping old versions of things.
I wonder if anyone has any suggestions about how to best setup a file share in a system where many people might want to edit the same file, with remote users needing to take copies of directories along with them on the road, and where the admin wants to keep revisions of things?
Links to articles or books are welcome. Thanks.Subversion works great for code. Sort-of-ok for documents. Not so great for large data files.
I'm now looking at using the wiki for project-level documentation. We've done that before quite successfully, and the wiki I was using (mediawiki) provides version history of pages and uploaded files, and stores the uploaded files in the file system.
Which would leave just the large data files and some working files on the fileshare. Is there any way people can lock a file on the fileshare, to indicate to others that they are working on it and others shouldn't be modifying it? Is there a way to use unix permissions (user-group-other) permissions, "chmod oa-w" to lock a file and indicate that one is working on it?
I also looked at Alfresco, which provides a CIFS (windows SMB) view of data files. I liked it in principle, but the files are all stored in a database, not in the file system, which makes me uneasy about backups. (Sure, subversion also stores stuff in a database, not a file system, but everyone has a copy of everything so I only lose sleep about backups regarding version history, not backups on the most recent file version.)
John Abraham
[email protected] -
Best practice for version control B2B, ESB and BPEL
Hello,
we are setting up a new system using B2B, ESB and BPEL. The development team is more experienced working with PL/SQL, Oracle Workflow and we are worried that Jdeveloper generates changes to the source files during development and that we might have problems with the version control.
Is there any best practice for setting up version control for these systems? Do we need to take anything in particular into consideration when setting up the projects?
We are using Serena Dimensions 9.1 for version control with the add-on in Jdeveloper.
Thanks in advance!I believe JDeveloper has a plugin for Dimensions.
I havent used it but to get it, go to tools (It may be help I don't have JDeveloper on this machine to confirm) check for updates.
If you select the thrid party check box - next, you will see an entry for dimentions.
Configure the connection and develop as you would any other project.
cheers
James -
Recreating control file in RAC with noresetlogs
Hi all,
I need to recreate the controlfile in a 2-node RAC environment (9i)
for altering the MAXLOGHISTORY value. I will be using noresetlogs as I
have all the online logs available with me.
I referred to metalink note (Note:118931.1) for the same, and to
clarify the same, it refers to set cluster_database to false and then
to true after creating the new controlfile.
Here I have Log Groups 1,2,5,6,7 belongs to instance1 and the rest belongs to
instance2
Below is the trace of controlfile...
create controlfile reuse database "prod" noresetlogs force logging
archivelog
maxlogfiles 64
maxlogmembers 3
maxdatafiles 800
maxinstances 32
maxloghistory 15000
logfile
group 1 '/dev/rprod_redo11' size 100m,
group 2 '/dev/rprod_redo12' size 100m,
group 3 '/dev/rprod_redo21' size 100m,
group 4 '/dev/rprod_redo22' size 100m,
group 5 '/dev/rprod_redo13' size 100m,
group 6 '/dev/rprod_redo14' size 100m,
group 7 '/dev/rprod_redo15' size 100m,
group 8 '/dev/rprod_redo23' size 100m,
group 9 '/dev/rprod_redo24' size 100m,
group 10 '/dev/rprod_redo25' size 100m
-- standby logfile
datafile
Please clarify on the same, do the traced controlfile need to have some thread info for redo logs & do I need to make the cluster_database parameter to fale/true.
Thanks!
Prat1. Create the trace file (with Create control file statements..)
2. Edit the trace file, to remove the log groups which doesn't belong to Instance 1 (in you case you would be removing groups 3,4,8,9,10).
3. Shutdown all the instances.
4. edit the init.ora file to make CLUSTER_DATABASE=FALSE:
5. startup nomount instance 1.
6. Run the edited trace file to create the control file.
7. shutdown instance 1.
8. edit the init.ora file to make CLUSTER_DATABASE=TRUE;
9. Startup instance 1;
10. Add the log groups for the instance 2 (groups 3,4,8,9,10)
11. Add tempfiles as indicated in the trace file.
12. Enable thread 2;
13. Startup instance 2.
As always, take backups.
HTH
Thanks
Chandra -
What are the best tools for converting .shg files to HTML image maps?
After trying several different ways to import our WinHelp
project into RH HTML, I'm left with recreating the project in HTML.
There are over 200 .shg files. What's the best tool for converting
them? Is there a free program that converts them? Or is there a
better way?
LaconaYes, I have not been able to import the .hlp file, which was
my last posted question/issue. I have tried creating a Microsoft
HTML layout in RH4 Word; it begins to compile and, somewhere in the
process, just freezes. I've tried importing the .hlp file into RH
HTML; same result. I've tried creating a new HTML project with the
.hlp file; same result. If I could import the file, it'd be great.
Otherwise, I'll need to recreate the entire project, which brings
me to converting the .shg files. Any ideas? -
A script for copying smilar files to a new location
Hi,
i newbies to scripting. My challenge is that I want a script to only copy files with names "similar" and not "exactly the same" as the filenames in the text file.
For example some files have 10 letters file name like "ABC01FGH01.tif". I have to copy file where starting letter "ABC" and middle letter "FGH" of file name are fixed, but other letters are changed.
The script sees a file name like "ABC**FGH**.tif", it should search the source location and copy the files having filenames with at least this characters e.g. "ABC02FGH02.tif", "ABC03FGH04.tif" should be copied since it has
contains "ABC**FGH**.tif".
Please help.Learn how to use wildcards in file names. '*' is for any number of characters and'?' is for one character.
COPY ABC??DE???.?x? c:\target
Start by using DIR
DIR ABC??DEF???JK.?x?
¯\_(ツ)_/¯ -
Hello all,
I have read the forums and know that I cannot use the Log and Transfer function on Final Cut Express 4.0 for my AVCHD files (from my Panasonic HC-V700) AFTER I have transfered the files out of the original root directory. Unfortunately, I did not know this until recently and I have a bunch of old footage in .mts form that I copied onto my harddrive WITHOUT the root directory. I now must get it into Final Cut Express 4.0.1. and I would like to use a Log and Transfer style program so that I can select what I need and erase the rest. I know about the program VoltaicHD which can be used for this purpose. I have not yet purchased it, but I will if this is my best option. The downsides to it are that it takes a lot of time to process the files (i hear from this forum) and that it creates extremely large files (hearsay from this forum, though I would like to know just how big those files are and how they compare to the size of files final cut creates). When I tried the trial version, I also noticed that unlike the log and transfer function in Final Cut Express 4.0.1, you cannot capture multiple subclips from a single clip. Well you can, but you have to load the clip into the viewing window again, which is not ideal.
I would love some more advice on this. I imagine other people have made this same mistake and have had to figure their way out of it.
I was also wondering is it possible to use Final Cut Express's Log and Transfer program directly from files if they are in a different file format. So far my experiments with this have failed. But if this is possible, I suppose I can also just convert all the backlogged files wholesale into a format that Final Cut Express supports more easily for Log and Transfer (What file format would this be? Sorry I am new to this). My new harddrive has a lot of free space, so I could probably handle the huge amount of storage that this would require for the raw footage and then I could erase it after I log and transfer just what I need. In which case, do folks have recommendations for a file convertor. I am dealing with over hundreds of files and I don't think the free online convertors would work. This product has been suggested to me, but I know very little about it.
Thanks!
MiraI am also finding, when I use Voltaic trial version, that the quicktime movies it creates are of inferior quality than those created through log and transfer into final cut express and imovie, particularly during rapid movement. There's a lot of visible lines running horizontally around areas of rapid movement (not sure what the lingo is for this).
Anyway, now I am getting accustomed to the idea that my best bet is probably just a high quality converter to get my mts files into something more useable by final cut. At this point, I am willing to sit through the render time that it will take on final cut express while I edit. I am just trying to get my footage into workable format without losing quality.
Thank you!
Mira -
Script for moving & deleting files
Hi
I'm quite new to scripts & looking for a script to move selected files with time-stamp & also a script to delete selected file/s in a directory. Below is an example of my requirement
Move
Ex: c:\work\source\test.txt to c:\work\target\test.txt_04202015022100
Delete
Ex: c:\work\target\test-1.txt
Could someone help me please.
Thank very much
NeilThis forum is for scripting questions rather than script requests.
Please start by reading the following:
Posting guidelines
Handy tips for posting to this forum
How to ask questions in a technical forum
Rubber duck problem solving
How to write a bad forum post
Help Vampires: A Spotter's Guide
-- Bill Stewart [Bill_Stewart] -
Problem in recreating control file
Hi,
When i recreate controlfile ... It creates a set of datafile...
FILE# NAME STATUS
84 /u01/app/oracle/product/10.2.0/dbs/MISSING00084 RECOVER
85 /u01/app/oracle/product/10.2.0/dbs/MISSING00085 RECOVER
86 /u01/app/oracle/product/10.2.0/dbs/MISSING00086 RECOVER
Only these datafiles give problem... but these or no way related to my db. And i dint create.Hi,
I have took the trace of the control file , from that i recreated the control file.
after creating the control file when i query,
select name from v$datafile;
i dint find the files.. but when i gave
alter database open resetlogs;
alter this only the file appears...
oracle version is 10.2.0 -
Script for emailing multiple file types?
Is there a script that will allow me to place a button on a form, that when clicked, will email the completed form in PDF format as well as in csv, or xml format?
Thanks!Wow, thanks. That was extremely helpful, but I have a couple questions.
First, is there a way to make it print to CUPS without opening the default application for the particular file first? For example, I used a .docx file, and it had to open microsoft word to send the job the print. This makers it very unpredictable to decide how much time the automator application will need to pause. If that file were for example, and adobe illustrator file, it would take an incredible amount of time just for illustrator to open. I don't really anticipate needing to do this a whole lot with anything other than text files and standard image types, but is that the only way for those other files to print? I figured that since OS 10.6 can do a quick look preview on just about any file type I use, that the OS would be able to do this without the application actually opening, but it seems not to be the case. Just wondering.
The other issue is the only real problem, and it's one that I have had whenever I use automator to make PDFs. It always duplicates the job. So, I am getting a combined pdf, but it has the same file in there 2 or even 3 times.
In automator, I used:
get selected finder items
then
print finder items
I have verified that it is printing everything multiple times because I see them going into the CUPS folder twice. Then, the final PDF sometimes even has the same doc or image in it 3 times. I have always had this problem with automator and PDFs, any idea how to solve that?
Other than that duplication issue, this seems like it will work perfectly! Thanks for the reply here! -
PHP Upload script for ZIP/SIT files
Hi,
I'm trying to locate a decent script that would allow clients
to upload files to a Web site that I am working on. I found a basic
one that works at www.w3schools.com/PHP/php_file_upload.asp.
However, it lack the capabilities to upload zip and sit files.
Could I modify the existing script that I just mentioned?
Unfortunately, I am not very PHP saavy. I have been Googling for
such a script but have not found one yet. I hope some one could
recommend a decent script. Thanks..oO(Mark A. Boyd)
>Carlton Chin posted in macromedia.dreamweaver.appdev:
>
>> I'm trying to locate a decent script that would
allow clients to
>> upload files to a Web site that I am working on. I
found a basic
>> one that works at
www.w3schools.com/PHP/php_file_upload.asp.
>> However, it lack the capabilities to upload zip and
sit files.
>> Could I modify the existing script that I just
mentioned?
>
>The ticket is where the script is checking
$_FILES["file"]["type"].
>See
http://www.w3schools.com/media/media_mimeref.asp
>
>If you only want to allow zip/sit, try changing this:
>
><?php
>if ((($_FILES["file"]["type"] == "image/gif")
>|| ($_FILES["file"]["type"] == "image/jpeg")
>|| ($_FILES["file"]["type"] == "image/pjpeg"))
>&& ($_FILES["file"]["size"] < 20000))
Be careful. These informations can be faked or might not be
available at
all. I can easily upload a PHP script as "image/jpeg". If the
file ends
up in a public directory within the document root, I can
execute it and
then have a look at the entire server ...
Relying on the content type or file extension is a huge
security hole!
I'm quite surprised that W3Schools publishes such an insecure
script.
To make sure that an uploaded file is really of the type you
expect, you
must look at its content! For images you can use
getimagesize(), which
will also return the type if it's a valid image. For other
types you
have to use other libs or external tools. On a *nix machine
you could
execute the shell command 'file' for example, which
recognizes quite a
lot of different file types.
Micha
Maybe you are looking for
-
My iPad is not detected in itunes
I just got the newest version of itunes in my computer. I have windows 8 64-bits installed. I can't get my ipad 1 or my iphone 4 to get connected to itunes but they show up in the explorer. I don´t have ios7 in eather and before the upload everythi
-
Hi Experts, I have a input structure like, Record - <Infotype1> - <ITEM> - <Infotype2> - <ITEM> - <Infotype3> - <ITEM> - <Infotype4> - <Field1> - <field2> - <fi
-
I have a Dell U3011 Monitor and I am about ready to toss it across the room. My problem is that my colors are WAY oversaturated so when I design in Photoshop and take it to web the colors are exceedingly oversaturated. I've tried various profiles, ca
-
Problem in Technical System Creation Wizard in Portal SLD
Hi When I am trying to Create New Technical System for WEB AS ABAP, I am getting the following error at the Installed Production phase in the Portal SLD *CIM_ERR_FAILED: Unable to execute createInstance() request, exclusive write mode is enabled* Pl
-
XL Reporter working on W Vista OS
Hi, I am wondering if somebody was able to make XL Reporter work properly under Windows Vista OS (Personaly I have W Vista Ultimate 64x). I don't know when (if) SAP plans to make XL Reporter compatible with Vista and Office 2007. In my case, having S