Instance started with pfile or spfile?
How to know which parameter file used for start the instance?
SQL> show parameter spfile;
NAME TYPE VALUE
spfile string /oracle/product/10.2.0/db_1/db
s/spfileneon.ora
if you get the path under the VALUE column, it means that you have used spfile to open the db..
Similar Messages
-
Instance starting with profile of another instance
Hi,
For PRD we have 2 host for load balancing.On 1st CI+DB & aaplication instance,on 2nd 2 application instances[D01 & DVEBMGS00].The instance DVEBMGS00 on 2nd host while starting taking the profile of instance on 1st host.But when checked in RZ03 it's not started. Here is th RZ03 screeshot.
Server Name Services Status Configuration alerts
sapp3p01_P3P_00 DVEBMGS Active
sapp3p02_P3P_00 Not active
sapp3p02_P3P_01 DS Active Work processes differ
Kindly suggest to start the instance.
Thanks & Regards,
SamHello,
Here are the logs of startsap_DVEBMGS00.log
Called command: /usr/sap/P3P/SYS/exe/run/startsap
Starting SAP Instance DVEBMGS00
SAP-R/3-Startup Program Rel 640 V1.8 (2003/04/24)
Starting at 2010/04/22 09:09:38
Startup Profile: "/usr/sap/P3P/SYS/profile/START_DVEBMGS00_sapp3p02"
Execute Pre-Startup Commands
(21657) Local: /usr/sap/P3P/SYS/exe/run/sapmscsa -n pf=/usr/sap/P3P/SYS/profile/P3P_DVEBMGS00_sapp3p01
/usr/sap/P3P/SYS/exe/run/sapmscsa: SCSA is attached and useable.
/usr/sap/P3P/SYS/exe/run/sapmscsa: finished.
(21657) Local: rm -f ms.sapP3P_DVEBMGS00
(21657) Local: ln -s -f /usr/sap/P3P/SYS/exe/run/msg_server ms.sapP3P_DVEBMGS00
(21657) Local: rm -f dw.sapP3P_DVEBMGS00
(21657) Local: ln -s -f /usr/sap/P3P/SYS/exe/run/disp+work dw.sapP3P_DVEBMGS00
(21657) Local: rm -f co.sapP3P_DVEBMGS00
(21657) Local: ln -s -f /usr/sap/P3P/SYS/exe/run/rslgcoll co.sapP3P_DVEBMGS00
(21657) Local: rm -f se.sapP3P_DVEBMGS00
(21657) Local: ln -s -f /usr/sap/P3P/SYS/exe/run/rslgsend se.sapP3P_DVEBMGS00
Starting Programs
(21685) Starting: local ms.sapP3P_DVEBMGS00 pf=/usr/sap/P3P/SYS/profile/P3P_DVEBMGS00_sapp3p01
(21686) Starting: local dw.sapP3P_DVEBMGS00 pf=/usr/sap/P3P/SYS/profile/P3P_DVEBMGS00_sapp3p01
(21687) Starting: local co.sapP3P_DVEBMGS00 -F pf=/usr/sap/P3P/SYS/profile/P3P_DVEBMGS00_sapp3p01
(21688) Starting: local se.sapP3P_DVEBMGS00 -F pf=/usr/sap/P3P/SYS/profile/P3P_DVEBMGS00_sapp3p01
(21657) Waiting for Child Processes to terminate.
Instance on host sapp3p02 started
I'm starting with command startsap r3 DVEBMGS00
Regards,
Sam -
Hi,
I'm having troubles trying to retrieve instances of processes when they are created with LiveCycle API using ServiceClient.invoke(invocationRequest).
As far that I can see, process instances are created correctly (I can manage them in LiveCycle AdminUI and in LiveCycle Workspace), but I can't retrieve them using TaskManagerQueryService.processInstanceList(...) or TaskManagerQueryService.processSearch(...), as process instances are simply missing... the strange thing is that process instances created with LiveCycle Workspace are returned correctly.
Someone could help me to figure out the problem?
Thanks,
Luca.I'm also interrested on the solution. I have to find all process instances for a given serviceName having a given valriable to a defined value.
The API seams to ansmwer, but in fact, the function procesSearch never find any process, probably because of the fact that no user are participating to the searched process.
In an old pos, I have found a solution based on POF api. Does this api exit for ADEP - 10.0.1?
Searching for a task, the property filter.setAdminIgnoreAllAcls(true); does the work. But this property does not exists in ProcessSearchFilter...
Thanks
Used code for info:
ServiceConnectionHelper connHelper = new ServiceConnectionHelper(
livecycleServerAddress, userName, password);
TaskManagerQueryService queryService = connHelper
.getTaskManagerQueryService();
// Yet, we are building the process search on the variable
ProcessSearchFilter pSearch = new ProcessSearchFilter();
pSearch.setServiceName(processName);
pSearch.addCondition("procVar." + variableName, Operator.CONTAINS,
variableValue);
List<ProcessInstanceRow> allProcesses = queryService
.processSearch(pSearch);
List<ProcessInstanceRow> toReturn = new ArrayList<ProcessInstanceRow>();
for (ProcessInstanceRow row : allProcesses) {
if (row.getProcessInstanceStatus() == ProcessInstanceRow.STATUS_RUNNING) {
toReturn.add(row);
Denis -
Error:cannot backup SPFILE because the instance was not started with SPFILE
I get the following error message, what I have done wrong?
Starting backup at 27-JUN-08
released channel: ch1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 06/27/2008 10:11:54
RMAN-06062: can not backup SPFILE because the instance was not started with SPFILE
Best Regards,
FanShow parameter pfile/spfile will not show you contents of pfile , for seeing contents you will have to show parameter with required parama name.
show parameter log_archive_dest
Whenever you start database ostartup first by default use spfile$Oracle_Sid.ora for starting the instance if this spfile does not exist then it goes for spfile.ora if spfile.ora also does not exist then it search init$Oracle_Sid.ora in default location.
As you created spfile after restarting the database will automatically use spfile and will show you spfile in yours param when you will show parameter spfile if it does not show then you are still using pfile
SQL> startup pfile='C:\oracle\product\10.1.0\admin\lease\pfile\init.ora.5242008172537'
ORACLE instance started.
Total System Global Area 171966464 bytes
Fixed Size 787988 bytes
Variable Size 145488364 bytes
Database Buffers 25165824 bytes
Redo Buffers 524288 bytes
Database mounted.
Database opened.
SQL> show parameter pfile
NAME TYPE VALUE
spfile string
SQL> create spfile from pfile
2 /
File created.
SQL> show parameter pfile
NAME TYPE VALUE
spfile string
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 171966464 bytes
Fixed Size 787988 bytes
Variable Size 145488364 bytes
Database Buffers 25165824 bytes
Redo Buffers 524288 bytes
Database mounted.
Database opened.
SQL> show parameter pfile
NAME TYPE VALUE
spfile string C:\ORACLE\PRODUCT\10.1.0\DB_2\
DATABASE\SPFILELEASE.ORA
SQL> -
Knwoing the database was started with which pfile/spfile
hello to everyone,
Actually, a question that crossed my mind and I wondered if it's possible in Oracle.
For an already started database, is there a way to know the database was started with which pfile/spfile? Is there a view that tells this for example.
Many thnx.
H HiruyaIf spfile parameter is null, then you can look for a
pfile with the name convention of
init<ORACLE_SID>.ora.Yes, you can, but that won't tell you anything about which pfile was used to start the instance. I can just as easily type:
startup pfile=/my/pfile/that/does/not/conform/to/any/naming/standard
There's no way to definitively determine which pfile was used to start an instance.
-Mark -
Can't we start a RAC instance without local pfile ?
DB version : 11.1.0.7.0
OS : Solaris 10 SPARC
--Info about the cluster
2 Node RAC
Both instances using spfile stored in ASM Diskgroup
Passwordless SSH configuration is not working currently (i gather ssh is not mandatory after installation)
We have 7 RAC DBs running in our 11.1 CRS.
After a reboot of our 2 Node RAC servers, in Node2, 4 instances didn't come up.
None of these down instances have a local pfile. The ones that are up in Node2 have it.
So, When i manually tried to bring up the ones that are down
$ sqlplus / as sysdba
SQL*Plus: Release 11.1.0.7.0 - Production on Fri Mar 2 21:28:22 2012
Copyright (c) 1982, 2008, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.1/db_1/dbs/initorcl2.ora'
SQL> exit
Disconnected-- Tried directly with spfile (No such option in oracle, but still tried ! )
SQL> startup spfile='+ORCL_DATA01/ORCL/spfileorcl.ora'
SP2-0714: invalid combination of STARTUP options-- Tried from Node1
-- This might have failed because ssh is not working currently. Not sure
$ srvctl start instance -d orcl -i orcl2
PRKP-1001 : Error starting instance orcl2 on node manhclust199
CRS-0215: Could not start resource 'ora.orcl.orcl2.inst'.
$ srvctl start database -d orcl
PRKP-1001 : Error starting instance orcl2 on node manhclust199
CRS-0215: Could not start resource 'ora.orcl.orcl2.inst'.Finally I had to create a local pfile on node2 for each instances in OH/dbs
The content of each local pfile is like
$ cat initorcl2.ora
spfile='+ORCL_DATA01/orcl/spfileorcl.ora'Now the startup worked without any issue for all 4 instances
SQL> startup
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size 2155464 bytes
Variable Size 1593838648 bytes
Database Buffers 536870912 bytes
Redo Buffers 5021696 bytes
Database mounted.
Database opened.So, local pfile is mandatory for all RAC instances ?Hi,
My question is whether this instance specific local pfile must be there in OH/dbs directory ?YES
Didn't get a clear answer yet.
It seems that it is mandatory. And this is most probably the reason these instances didn't come up after the reboot of this node.Startup Sequence:
Startup of Cluster:
Using "srvctl" to start your database/instance:
Srvctl read the OCR and check the parameter SPFILE from your database registration:
If parameter SPFILE in OCR have a value the srvctl will use this value to start your database instance.
If parameter SPFILE in OCR don't have a value (i.e null) Oracle will try find the file SPFILE<ORACLE_SID>.ora on $ORACLE_HOME/dbs
If the file SPFILE<ORACLE_SID>.ora does not exists, Oracle will try use the file init<ORACLE_SID>.ora
If init<ORACLE_SID>.ora does not exist... the startup will fail.
From ORACLE_HOME of your database execute command above to get value of Spfile parameter on OCR:
srvctl config database -d <DB_NAME> |grep SpfileStartup manually from SHELL using SQLPLUS:
Using SQLPLUS to start a database Oracle always first use SPFILE<ORACLE_SID>.ora stored on $ORACLE_HOME/dbs/ if this file does not exist he will try use INIT<ORACLE_SID>.ora to start Database Instance.
If your spfile is stored on ASM you must create a INITFILE pointing to SPFILE stored on ASM.
e.g From instance 1
cat /oracle/oracle/product/11.2.0/db_1/dbs/initorcl1.ora
SPFILE='+DATA/ORCL/spfileorcl.ora'Regards,
Levi Pereira -
DB is not starting with spfile .
Hi ,
i am running DB (10.2.0.4) DB on solaris.x64 platform.
When i started the database after install , its giving error as
SQL> startup
ORA-00064: object is too large to allocate on this O/S (1,3994560)
I checked the sga_target size in spfile , which is set to (729145600 bytes ~ 595 M)
When installed another DB with sga_target size as 412 M
and started the DB it gives follwing error .
SQL> startup
SQL> ORA-00821: Specified value of sga_target 412M is too small, needs to be at least 552M
if i start the same DB with pfile where sga_target has set to 1632 M , the DB is starting successfully.
My question is if it is starting with this higher value of sga_target in with pfile , why it is not starting with a lesser value.Cause: The specified value of sga_target is too small for the SGA to accommodate all of the necessary SGA components such as the log buffer, buffer pools, shared pool, etc.
Action: Set sga_target to the recommended value or reduce the values of any SGA component size parameters you have specified.
The previous solutions where correct, but if you're not providing a full path on the "CREATE SPFILE" make sure you have defined the parameter SPFILE. Otherwise you'll get the SPFILE created on $ORACLE_HOME/dbs/spfileDBNAME.ora
Regards,
Enric Moya -
Creating Pfile from Spfile while Instance is down
We can create pfile from the spfile of an instance which is currently shut down. Right?
SQL*Plus: Release 11.1.0.7.0 - Production on Mon Apr 12 02:06:52 2010
Copyright (c) 1982, 2008, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create pfile from spfile;
File created.Reason why we need it:
We used to have an instance which consumed 5 gb Memory_target and then we shut it down. It was using SPFILE. Now we want to bring up this instance with only 3gb Memory_target. So we are thinking of editing the pfile created using the above method. It should be fine. Right?GarryB wrote:
We can create pfile from the spfile of an instance which is currently shut down. Right?
SQL*Plus: Release 11.1.0.7.0 - Production on Mon Apr 12 02:06:52 2010
Copyright (c) 1982, 2008, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create pfile from spfile;
File created.Reason why we need it:
We used to have an instance which consumed 5 gb Memory_target and then we shut it down. It was using SPFILE. Now we want to bring up this instance with only 3gb Memory_target. So we are thinking of editing the pfile created using the above method. It should be fine. Right?Right -
How can start service from the spfile, on Windows 2003,
On Windows 2003, how can start service from the spfile?
connect to the database as sysdba and startup will start from the spfile.
Once I use wondows Service for shutting down and startup datbase it start from the pfile.
Which defeat my ability to change parameters at the system level.Hi,
I'm not sure, but maybe your windows Instance service was created with
C:\> oradim -new -sid <SID> -startmode m -pfile C:\oracle\product\10.1.0\admin\pfile\init.ora
then, you need edit this service with command like below:
C:\> oradim -EDIT -SID <SID> -spfile C:\oracle\product\10.1.0\admin\spfile<SID>.ora
Take a look on this link before make any changes:
http://www.stanford.edu/dept/itss/docs/oracle/10g/win.101/b10113/create.htm#i1006533
Cheers -
Db started with Which parameter file
Hello all,
Can you please tell me how to find whether the database is started using spfile or pfile.
Db version : 10.2.0.3.0
OS : linux : 5.4
ThanksMahirM.Quluzade wrote:
I want share my test environment results:
Database started with SPFILE;
SQL> create pfile='c:\test.or' from spfile;
File created.
SQL> select decode(count(*), 1, 'spfile', 'pfile' ) from v$spparameter where rownum=1 and isspecified='TRUE';
DECODE
spfile
SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup pfile='c:\test.or'
ORACLE instance started.
otal System Global Area 801701888 bytes
Fixed Size 2180024 bytes
Variable Size 532679752 bytes
Database Buffers 264241152 bytes
Redo Buffers 2600960 bytes
Database mounted.
Database opened.
SQL> select decode(count(*), 1, 'spfile', 'pfile' ) from v$spparameter where rownum=1 and isspecified='TRUE';
DECODE
pfile
Regards
Mahir M. Quluzade
Just a short explanation about that complicated query to remember IMHO:
SQL> select count(*) from v$spparameter where isspecified='TRUE';
COUNT(*)
49
SQL> create pfile='/home/oracle/mypfile.ora' from spfile;
File created.
SQL> startup pfile=/home/oracle/mypfile.ora
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size 2085464 bytes
Variable Size 855641512 bytes
Database Buffers 1124073472 bytes
Redo Buffers 165683200 bytes
Database mounted.
Database opened.
SQL> select count(*) from v$spparameter where isspecified='TRUE';
COUNT(*)
0
SQL>
That basically remains the same as I explained earlier, nothing is retained when you start the db with a pfile.
Nicolas. -
ORA-00444 & ORA-07446 while startup nomount with pfile(DB installation)
Hi
I am trying to create a single instance 10g database in a rac machine (SOLARIS) I had setuped the pfile and create DB scripts too. When I try startup nomount with pfile its throwing below error.
$
$ sqlplus
SQL*Plus: Release 10.2.0.4.0 - Production on Mon Jan 7 21:45:19 2013
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Enter user-name: /as sysdba
Connected to an idle instance.
SQL> startup nomount pfile='/oracle/app/oracle/product/10.2.0/db/dbs/initdrc.ora';
ORA-00444: background process "LMD0" failed while starting
ORA-07446: sdnfy: bad value '' for parameter .
SQL>
Please find the init file contents.
*.audit_file_dest='/oracle/app/oracle/admin/drc/adump'
*.background_dump_dest='/oracle/app/admin/drc/bdump'
*.compatible='10.2.0.4.0'
*.control_files='+DATA/DRC/control01.ctl','+DATA/DRC/control02.ctl','+DATA/DRC/control03.ctl'
*.core_dump_dest='/oracle/app/oracle/admin/drc/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='drc'
*.sga_target=1184M
*.sga_max_size=1184M
*.dispatchers='(PROTOCOL=TCP) (SERVICE=drcXDB)'
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=411041792
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/oracle/app/oracle/admin/drc/udump'
Already another rac database is running successfully on this machine through ASM. We are trying to use the same ASM instance for this single instance database. When I tried using dbca it was not reading the current ASM instance. Instead it was trying to create new instance. Thats y I was forced to create new DB manually.
Kindly help in resolving this issue.
Thanks
SHIYAS M965652 wrote:
Hi
I am trying to create a single instance 10g database in a rac machine (SOLARIS) I had setuped the pfile and create DB scripts too. When I try startup nomount with pfile its throwing below error.
$
$ sqlplus
SQL*Plus: Release 10.2.0.4.0 - Production on Mon Jan 7 21:45:19 2013
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Enter user-name: /as sysdba
Connected to an idle instance.
SQL> startup nomount pfile='/oracle/app/oracle/product/10.2.0/db/dbs/initdrc.ora';
ORA-00444: background process "LMD0" failed while starting
ORA-07446: sdnfy: bad value '' for parameter .
SQL>
07446, 00000, "sdnfy: bad value '%s' for parameter %s."
// *Cause: The directory specified as the value for the stated parameter could
// not be used.
// *Action: Make sure the directory you have specified is a valid
// directory/file specification.post results from OS command below
ls -l /oracle/app/oracle/product/10.2.0/db/dbs/initdrc.ora -
Hello everybody,
I have a question. With database instance spfile in asm, when database instance start, it will need asm extend map file to read the spfile. After the instance start, extend map file will locate in share pool. But before instance start where oracle store information in spfile in ? Which memory store database spfile before database instance start ? which process will read database spfile to start database instance ?I have a question. With database instance spfile in asm, when database instance start, it will need asm extend map file to read the spfileyou have specifies asm....
http://www.oracleportal.org/knowledge-base/oracle-database/database-concepts/general/how-is-database-opened-.aspx
http://www.oracleportal.org/knowledge-base/oracle-database/database-concepts/general/what-is-spfile-.aspx -
Create pfile from spfile when oracle in idle mode
Create pfile from spfile when oracle in idle mode
from where it creates pfile?? note:-oracle is in idle stage..Since you are asking for creating PFILE so I think below text will answer your question :
If you do not specify spfile_name, then the database uses the spfile that is currently associated with the instance, usually the one that was used a startup. If no spfile is associated with the instance, then the database looks for the platform-specific default server parameter file name. If that file does not exist, then the database returns an error.http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_6008.htm#i2072768
Regards
Girish Sharma -
How to enable block change tracking with pfile
Hello
I want to use enable block change tracking (for fast incremental RMAN backup). kindly advice how can i use this parameter using pfile.
Thanks
KrishnaKrishna Agnihotri wrote:
Hello
I want to use enable block change tracking (for fast incremental RMAN backup). kindly advice how can i use this parameter using pfile.
You could have just tried ,
D:\app\aristadba\product\11.2.0\dbhome_1\database>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue Aug 30 10:04:20 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup pfile=initorcl112.ora
ORACLE instance started.
Total System Global Area 263639040 bytes
Fixed Size 1373964 bytes
Variable Size 213911796 bytes
Database Buffers 41943040 bytes
Redo Buffers 6410240 bytes
Database mounted.
Database opened.
SQL> alter database enable block change tracking using file 'block';
Database altered.
SQL>Just to show that the file actually gets created,
SQL> alter database enable block change tracking using file 'block';
Database altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
D:\app\aristadba\product\11.2.0\dbhome_1\database>dir
Volume in drive D has no label.
Volume Serial Number is A408-F176
Directory of D:\app\aristadba\product\11.2.0\dbhome_1\database
08/30/2011 10:05 AM 11,600,384 BLOCK
05/17/2010 10:45 AM 2,048 hc_orcl112.dat
10/17/2009 01:35 PM 1,015 INITorcl.ORA
08/30/2011 10:01 AM 1,042 INITorcl112.ORA
12 File(s) 21,412,139 bytes
3 Dir(s) 17,036,451,840 bytes free
D:\app\aristadba\product\11.2.0\dbhome_1\database>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue Aug 30 10:06:40 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> alter database disable block change tracking;
Database altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
D:\app\aristadba\product\11.2.0\dbhome_1\database>dir
Volume in drive D has no label.
Volume Serial Number is A408-F176
Directory of D:\app\aristadba\product\11.2.0\dbhome_1\database
08/30/2011 10:06 AM <DIR> .
08/30/2011 10:06 AM <DIR> ..
05/17/2010 08:55 AM <DIR> archive
05/17/2010 10:45 AM 2,048 hc_orcl112.dat
10/17/2009 01:35 PM 1,015 INITorcl.ORA
08/30/2011 10:01 AM 1,042 INITorcl112.ORA
12/22/2005 04:07 AM 31,744 oradba.exe
08/30/2011 09:05 AM 9,314 oradim.log
12/24/2009 08:09 PM 1,536 PWDorcl.ora
08/07/2011 11:00 PM 1,536 PWDorcl112.ora
04/15/2011 05:52 PM 9,748,480 SNCFORCL112.ORA
02/10/2011 09:00 PM 3,584 SPFILEORCL.ORA
08/30/2011 09:59 AM 3,584 SPFILEORCL112.ORA
02/10/2011 09:07 PM 7,872 upgrade.logAman....
Edited by: Aman.... on Aug 30, 2011 10:08 AM added 2nd code snippet -
How to access a JSON structure key that starts with a number
I've got an odd issue here. I'm accessing someone else's JSON structure so I am not able to change it. The JSON structure keys are named with both characters and numbers like this:
0
198456
product_id
198456
1
Rashaan Houston feat Tony Loreto
artist
Rashaan Houston feat Tony Loreto
So, in other words, there's a key named "0" and a key named "product_id", both of which contain the same key. Why they did that, I don't know, but they did.
In one of the instances, the data stored under the text-named key isn't the same as the numerical-named key. I tried to output the data in the numerical key like this (it's an array of structures):
#strStompyJSON.data[1].0#
but I get the following error:
Invalid CFML construct found on line 41 at column 31.
ColdFusion was looking at the following text:
.0
When I do the following, it works fine:
#strStompyJSON.data[1].product_id#
So it looks as though CF doesn't like accessing a variable that starts with a number. I am able to loop through the structure using a collection loop, and it outputs all of the keys (including the numerical ones) and their values using the following code:
<cfloop collection="#strStompyJSON.data[1]#" item="key">
#key#: #strStompyJSON.data[1][key]#<br />
</cfloop>
However, that doesn't allow me a way to access specific keys named with a number. Is there a way that I can specifically access a key that is named with a number?
thanks!
MikeNo problem--glad it worked out.
As a follow-up to this, I'd encourage you to keep the bracket notation in mind during future development. It is EXTREMELY useful in a lot of situations.
For example, if you're building a structure on the fly with dynamic keys, bracket notation is extremely helpful:
<cfset authors = structnew()>
<cfloop list="authorlist" index="name">
<cfset authors[name] = getbooklist(name)>
</cfloop>
Also, bracket notation is really nice when creating json from ColdFusion structures. Consider this:
<cfset author = structnew()>
<cfset author.name = "Neil Gaiman">
<cfset author.genre = "Fantasy">
<cfset author.awesome = true>
<cfset authorjson = serializejson(author)>
By default, the serialized json produced will have all UPPER CASE keys. Not a big deal in most cases, but if you're returning the json to something (like a JS library) that is expecting keys in a certain case, it can be a problem. Fortunately, bracket notation allows you to specify exactly what case you want the structure's keys to be in:
<cfset author = structnew()>
<cfset author['name'] = "Neil Gaiman">
<cfset author['Genre'] = "Fantasy">
<cfset author['AWESOME'] = true>
<cfset authorjson = serializejson(author)>
Maybe you are looking for
-
How to extract large voice memos from iphone
I need to extract a large (50 minutes) voice memo from an iPhone 4s using iOS 8.1.1 I'm using a MacBook Air 11-early 2014 with OS X Yosemite (10.10.1)
-
In Adobe 8 how do you create a bates log file?
I love this feature in Adobe 9 where one can select "output options" and change the way the bates stamped PDF is saved, to create a log file of bates numbers per document, etc. Are these same output options and bates log file options available in Ad
-
Crystal Reports for Visual Studio and (Wcf) Web Services
I´m evaluating Crystal reports for Visual Studio 2010. I want to read data from a (Wcf) Webservice into the predefined Reports and deliver them to the Users in an ASP.NET Application. As far as I see reading Webservices via the XML/Webservice datasou
-
LMS 4.2 bent or crooked Topology Map links
Hello all, I'm trying to include as much info as I can, so forgive the lengthy post. I have an ongoing issue with reoccurring bent or crooked Topology map links. Imagine two devices that are in the same region, even installed in the same data closet.
-
Mandatory Infotypes to post Timesheet data to Plant Maintenance orders
Hi all Can somebody tell: What are theMandatory Infotypes to post Timesheet data to Plant Maintenance orders via CAT2. I tried creating a data entry profile with PM/CS order objects checked,I need to know ,does it need to be assigned to the user id o